int i; //Initialise i as an intiger variable
void setup() {
// Declares pin 13 to 4 as Ouputs
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT);
pinMode(5,OUTPUT);
pinMode(4, OUTPUT);
}
void loop() {
// A for loop that switches on the LED lights from pin 13 to pin 4(left to right)
for(i = 13; i>=4 ; i--){
digitalWrite(i,HIGH);
delay(250);
digitalWrite(i,LOW);
}
// A for loop that switches on the LED lights from pin 13 to pin 4(left to right)
for(int i = 4 ; i <=13; i++){//A For loop that switches on the LED lights from right to left
digitalWrite(i, HIGH);
delay(250);
digitalWrite(i, LOW);
}
}