int mode = 0;
void setup() {
pinMode(7, INPUT_PULLUP);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
if (digitalRead(7) == LOW) {
delay(300);
if (mode == 0) {
mode = 1;
for (int i = 13; i >= 8; i--) {
digitalWrite(i, HIGH);
}
delay(1000);
for (int i = 13; i >= 8; i--) {
digitalWrite(i, LOW);
}
} else if (mode == 1) {
mode = 2;
for (int i = 13; i >= 8; i--) {
digitalWrite(i, HIGH);
delay(500);
digitalWrite(i, LOW);
}
} else if (mode == 2) {
mode = 0;
digitalWrite(12, HIGH);
digitalWrite(10, HIGH);
digitalWrite(8, HIGH);
delay(1000);
digitalWrite(12, LOW);
digitalWrite(10, LOW);
digitalWrite(8, LOW);
delay(1000);
digitalWrite(13, HIGH);
digitalWrite(11, HIGH);
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(13, LOW);
digitalWrite(11, LOW);
digitalWrite(9, LOW);
}
}
}