Stephanie: Arduino blinking lights

Here are the lights for the Knight Rider assignment!

 


int led1 = 13;
int led2 = 12;
int led3 = 11;
int led4 = 10;
int led5 = 9;
int led6 = 8;

// the setup routine runs once when you press reset:
void setup() { 
// initialize the digital pin as an output.
pinMode(led1, OUTPUT); 
pinMode(led2, OUTPUT); 
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
}


void loop() {
digitalWrite(led1, HIGH);
delay(100); 
digitalWrite(led1, LOW);
delay(100); 

digitalWrite(led2, HIGH); 
delay(102); 
digitalWrite(led2, LOW); 
delay(100); 

digitalWrite(led3, HIGH); 
delay(104); 
digitalWrite(led3, LOW); 
delay(100); 

digitalWrite(led4, HIGH); 
delay(106); 
digitalWrite(led4, LOW); 
delay(100); 

digitalWrite(led5, HIGH); 
delay(108); 
digitalWrite(led5, LOW); 
delay(100); 

digitalWrite(led6, HIGH); 
delay(110); 
digitalWrite(led6, LOW); 
delay(100); 

digitalWrite(led5, HIGH); 
delay(112); 
digitalWrite(led5, LOW); 
delay(100); 

digitalWrite(led4, HIGH); 
delay(114); 
digitalWrite(led4, LOW); 
delay(100); 

digitalWrite(led3, HIGH); 
delay(116); 
digitalWrite(led3, LOW); 
delay(100); 

digitalWrite(led2, HIGH); 
delay(118); 
digitalWrite(led2, LOW); 
delay(100); 
}

Post a comment