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

  • Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.

View
 

Blinking Lights Program

Page history last edited by Jonathan Dietz 7 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.