byte led = 13;
byte led1 = 12;
byte led2 = 11;
byte led3 = 10;
byte led4 = 9;
byte swPin = 8;
void setup() {
Serial.begin(115200);
pinMode(swPin, INPUT);
pinMode(led, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
}
void loop() {
boolean reading = digitalRead(swPin);
if(reading == 0 ){
digitalWrite(led,HIGH);
delay(500);
digitalWrite(led,LOW);
delay(500);
digitalWrite(led1,HIGH);
delay(500);
digitalWrite(led1,LOW);
delay(500);
digitalWrite(led2,HIGH);
delay(500);
digitalWrite(led2,LOW);
delay(500);
digitalWrite(led3,HIGH);
delay(500);
digitalWrite(led3,LOW);
delay(500);
digitalWrite(led4,HIGH);
delay(500);
digitalWrite(led4,LOW);
delay(500);
}
if(reading == 0 ){
digitalWrite(led4,HIGH);
delay(500);
digitalWrite(led4,LOW);
delay(500);
digitalWrite(led3,HIGH);
delay(500);
digitalWrite(led3,LOW);
delay(500);
digitalWrite(led2,HIGH);
delay(500);
digitalWrite(led2,LOW);
delay(500);
digitalWrite(led1,HIGH);
delay(500);
digitalWrite(led1,LOW);
delay(500);
digitalWrite(led,HIGH);
delay(500);
digitalWrite(led,LOW);
delay(500);
}
}