int red_lamp[] = {13, 10, 7};
void run_lamp(int red, int yellow, int green, int yellow_delay, int green_delay){
for(int i : red_lamp) {
digitalWrite(i, i != red);
}
digitalWrite(yellow, HIGH);
delay(yellow_delay);
digitalWrite(yellow, LOW);
digitalWrite(green, HIGH);
delay(green_delay);
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(yellow_delay);
digitalWrite(yellow, LOW);
}
void setup() {
for(int i = 5; i < 14; i++){
pinMode(i, OUTPUT);
}
}
void loop() {
run_lamp(13, 12, 11, 400, 3000);
run_lamp(10, 9, 8, 400, 3000);
run_lamp(7, 6, 5, 400, 3000);
}