Blink expected button on error

This commit is contained in:
Gabriel Augendre 2021-04-30 08:09:38 +02:00
parent b78ff4f184
commit b9035d0473
2 changed files with 12 additions and 1 deletions

View file

@ -15,5 +15,6 @@ byte waitForButton();
void error();
void endGame(LiquidCrystal lcd, bool win, byte score);
void configure();
void blink(byte index);
#endif //SUPER_SIMON_UTILS_H

View file

@ -65,6 +65,7 @@ bool userSequence(const byte sequence[], byte upTo) {
}
else {
error();
blink(expectedButton);
return false;
}
}
@ -97,4 +98,13 @@ void endGame(LiquidCrystal lcd, bool win, byte score) {
lcd.setCursor(0, 1);
lcd.print(score);
delay(10000);
}
}
void blink(byte index) {
for (byte i = 0; i < 3; i++) {
digitalWrite(LEDS[index], HIGH);
delay(100);
digitalWrite(LEDS[index], LOW);
delay(100);
}
}