| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Blinking Lights Program

Page history last edited by Jonathan Dietz 10 years, 11 months ago

 

 

 

See detailed explanation of Blink at

 

http://arduino.cc/en/Tutorial/Blink

 

See video explanation of this project at:

http://k12videos.mit.edu/content/arduino-tutorial-1--

 

what hardware components were omitted?


// each LED is connected through a 220 ohm resistor
// to the indicated digital pin
// long lead is +
// short lead is connected to ground

 

//set the pin ports

 

int ledA = 4;
int ledB = 5;
int ledC = 6;
 int ledD = 7;

 

//set LED pins as output pins


void setup() {
pinMode(ledA, OUTPUT);
pinMode(ledB, OUTPUT);
pinMode(ledC, OUTPUT);
pinMode(ledD, OUTPUT);
}

 
//actual loop for blinking lights; each LED is turn on then off in series
//make sure that the function is enclosed in brackets {}, not parentheses ()
//and that each statement ends with a semicolon;

 

void loop() {
digitalWrite(ledA, HIGH);
delay(125);
digitalWrite(ledA, LOW);
delay(125);

digitalWrite(ledB, HIGH);
delay(125);
digitalWrite(ledB, LOW);
delay(125);

digitalWrite(ledC, HIGH);
delay(125);
digitalWrite(ledC, LOW);
delay(125);

digitalWrite(ledD, HIGH);
delay(125);
digitalWrite(ledD, LOW);
delay(125);
}

Comments (0)

You don't have permission to comment on this page.