Introduction: Blinking LED Row
This is an arduino controlled project and uses leds, jumper wires, and a breadboard. This is one of my first attempts on programming arduino and I am pleased with the outcome. I'm ten years old and I just started programming 2 weeks ago.
This is simple wiring, and all you do is connect each negative terminal to itself and then to the arduino and each positive terminal to a positive pin on the arduino. Remember to connect them in order, ie. the first LED to pin #1 on the arduino and the second LED to pin #2.
This is the arduino code that I wrote.
#define LED01 13 // says led is at # 13
#define LED02 12
#define LED03 11
#define LED04 10
#define LED05 9
#define LED06 8
#define LED07 7
#define LED08 6
#define LED09 5
#define LED10 4
#define LED11 3
void setup()
{
pinMode(LED01, OUTPUT); // digital pin is output
pinMode(LED02, OUTPUT); // digital pin is output
pinMode(LED03, OUTPUT); // digital pin is output
pinMode(LED04, OUTPUT); // digital pin is output
pinMode(LED05, OUTPUT); // digital pin is output
pinMode(LED06, OUTPUT); // digital pin is output
pinMode(LED07, OUTPUT); // digital pin is output
pinMode(LED08, OUTPUT); // digital pin is output
pinMode(LED09, OUTPUT); // digital pin is output
pinMode(LED10, OUTPUT); // digital pin is output
pinMode(LED11, OUTPUT); // digital pin is output
}
void loop()
{
digitalWrite(LED01, HIGH); // turns LED on
delay(30);
digitalWrite(LED02, HIGH); // turns LED on
delay(30);
digitalWrite(LED01, LOW); // turns LED off
delay(30);
digitalWrite(LED03, HIGH); // turns LED on
delay(30);
digitalWrite(LED02, LOW);
delay(30);
digitalWrite(LED04, HIGH); // turns LED on
delay(30);
digitalWrite(LED03, LOW);
delay(30);
digitalWrite(LED05, HIGH); // turns LED on
delay(30);
digitalWrite(LED04, LOW);
delay(30);
digitalWrite(LED06, HIGH); // turns LED on
delay(30);
digitalWrite(LED05, LOW);
delay(30);
digitalWrite(LED06, LOW);
delay(30);
digitalWrite(LED08, HIGH); // turns LED on
delay(30);
digitalWrite(LED07, LOW);
delay(30);
digitalWrite(LED09, HIGH); // turns LED on
delay(30);
digitalWrite(LED08, LOW);
delay(30);
digitalWrite(LED10, HIGH); // turns LED on
delay(30);
digitalWrite(LED09, LOW);
delay(30);
digitalWrite(LED11, HIGH); // turns LED on
delay(30);
digitalWrite(LED10, LOW);
delay(30);
digitalWrite(LED11, LOW);
delay(30);
digitalWrite(LED11, HIGH);
delay(30);
digitalWrite(LED10, HIGH);
delay(30);
digitalWrite(LED11, LOW);
delay(30);
digitalWrite(LED09, HIGH);
delay(30);
digitalWrite(LED10, LOW);
delay(30);
digitalWrite(LED08, HIGH);
delay(30);
digitalWrite(LED09, LOW);
delay(30);
digitalWrite(LED07, HIGH);
delay(30);
digitalWrite(LED08, LOW);
delay(30);
digitalWrite(LED06, HIGH);
delay(30);
digitalWrite(LED07, LOW);
delay(30);
digitalWrite(LED05, HIGH);
delay(30);
digitalWrite(LED06, LOW);
delay(30);
digitalWrite(LED04, HIGH);
delay(30);
digitalWrite(LED05, LOW);
delay(30);
digitalWrite(LED03, HIGH);
delay(30);
digitalWrite(LED04, LOW);
delay(30);
digitalWrite(LED02, HIGH);
delay(30);
digitalWrite(LED03, LOW);
delay(30);
digitalWrite(LED01, HIGH);
delay(30);
digitalWrite(LED02, LOW);
delay(30);
digitalWrite(LED01, HIGH);
}
This is simple wiring, and all you do is connect each negative terminal to itself and then to the arduino and each positive terminal to a positive pin on the arduino. Remember to connect them in order, ie. the first LED to pin #1 on the arduino and the second LED to pin #2.
This is the arduino code that I wrote.
#define LED01 13 // says led is at # 13
#define LED02 12
#define LED03 11
#define LED04 10
#define LED05 9
#define LED06 8
#define LED07 7
#define LED08 6
#define LED09 5
#define LED10 4
#define LED11 3
void setup()
{
pinMode(LED01, OUTPUT); // digital pin is output
pinMode(LED02, OUTPUT); // digital pin is output
pinMode(LED03, OUTPUT); // digital pin is output
pinMode(LED04, OUTPUT); // digital pin is output
pinMode(LED05, OUTPUT); // digital pin is output
pinMode(LED06, OUTPUT); // digital pin is output
pinMode(LED07, OUTPUT); // digital pin is output
pinMode(LED08, OUTPUT); // digital pin is output
pinMode(LED09, OUTPUT); // digital pin is output
pinMode(LED10, OUTPUT); // digital pin is output
pinMode(LED11, OUTPUT); // digital pin is output
}
void loop()
{
digitalWrite(LED01, HIGH); // turns LED on
delay(30);
digitalWrite(LED02, HIGH); // turns LED on
delay(30);
digitalWrite(LED01, LOW); // turns LED off
delay(30);
digitalWrite(LED03, HIGH); // turns LED on
delay(30);
digitalWrite(LED02, LOW);
delay(30);
digitalWrite(LED04, HIGH); // turns LED on
delay(30);
digitalWrite(LED03, LOW);
delay(30);
digitalWrite(LED05, HIGH); // turns LED on
delay(30);
digitalWrite(LED04, LOW);
delay(30);
digitalWrite(LED06, HIGH); // turns LED on
delay(30);
digitalWrite(LED05, LOW);
delay(30);
digitalWrite(LED06, LOW);
delay(30);
digitalWrite(LED08, HIGH); // turns LED on
delay(30);
digitalWrite(LED07, LOW);
delay(30);
digitalWrite(LED09, HIGH); // turns LED on
delay(30);
digitalWrite(LED08, LOW);
delay(30);
digitalWrite(LED10, HIGH); // turns LED on
delay(30);
digitalWrite(LED09, LOW);
delay(30);
digitalWrite(LED11, HIGH); // turns LED on
delay(30);
digitalWrite(LED10, LOW);
delay(30);
digitalWrite(LED11, LOW);
delay(30);
digitalWrite(LED11, HIGH);
delay(30);
digitalWrite(LED10, HIGH);
delay(30);
digitalWrite(LED11, LOW);
delay(30);
digitalWrite(LED09, HIGH);
delay(30);
digitalWrite(LED10, LOW);
delay(30);
digitalWrite(LED08, HIGH);
delay(30);
digitalWrite(LED09, LOW);
delay(30);
digitalWrite(LED07, HIGH);
delay(30);
digitalWrite(LED08, LOW);
delay(30);
digitalWrite(LED06, HIGH);
delay(30);
digitalWrite(LED07, LOW);
delay(30);
digitalWrite(LED05, HIGH);
delay(30);
digitalWrite(LED06, LOW);
delay(30);
digitalWrite(LED04, HIGH);
delay(30);
digitalWrite(LED05, LOW);
delay(30);
digitalWrite(LED03, HIGH);
delay(30);
digitalWrite(LED04, LOW);
delay(30);
digitalWrite(LED02, HIGH);
delay(30);
digitalWrite(LED03, LOW);
delay(30);
digitalWrite(LED01, HIGH);
delay(30);
digitalWrite(LED02, LOW);
delay(30);
digitalWrite(LED01, HIGH);
}