#define BLUE 8U
#define PINK 9U
#define YELLOW 10U
#define ORANGE 11U
#define S1 12U
#define S2 13U
#define INTERVAL 1000u
void setup() {
for(unsigned char i = 0; i < 5; i++)
pinMode(BLUE + i, OUTPUT);
pinMode(S1, INPUT);
pinMode(S2, INPUT);
}
unsigned char c{};
bool both{};
long timestamp{};
void loop() {
if (millis() >= timestamp && !digitalRead(S1)) {
c = (c + both) % 4;
digitalWrite(BLUE + c, true);
if (!both)
digitalWrite(BLUE + (!c ? 3 : (c - 1)), false);
both = !both;
timestamp = millis() + INTERVAL;
}
}