001c_Night_Rider

Project Overview:

Create a program that can make the Arduino flash a series of LEDs from side to side.

Schematic:

Code:

int led2 = 2;

int led3 = 3;

int led4 = 4;

int led5 = 5;

int led6 = 6;

int pause = 100;

 

void setup() {

// initialize the digital pin as an output.

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);

pinMode(led4, OUTPUT);

pinMode(led5, OUTPUT);

pinMode(led6, OUTPUT);

}

 

void loop() {

digitalWrite(led2, HIGH);

delay(pause);

digitalWrite(led2, LOW);

delay(pause);

digitalWrite(led3, HIGH);

delay(pause);

digitalWrite(led3, LOW);

delay(pause);

digitalWrite(led4, HIGH);

delay(pause);

digitalWrite(led4, LOW);

delay(pause);

digitalWrite(led5, HIGH);

delay(pause);

digitalWrite(led5, LOW);

delay(pause);

digitalWrite(led6, HIGH);

delay(pause);

digitalWrite(led6, LOW);

delay(pause);

digitalWrite(led5, HIGH);

delay(pause);

digitalWrite(led5, LOW);

delay(pause);

digitalWrite(led4, HIGH);

delay(pause);

digitalWrite(led4, LOW);

delay(pause);

digitalWrite(led3, HIGH);

delay(pause);

digitalWrite(led3, LOW);

delay(pause);

}

 

Layout:

What I learned / Problems:

In this lesson I learned several things:

  • In this lesson I learned more on how to loop through code, regarding the Arduino
  • Furthermore, I learned how to wire several LEDs to the Arduino board

Problems encountered:

  • None