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 error();
void endGame(LiquidCrystal lcd, bool win, byte score); void endGame(LiquidCrystal lcd, bool win, byte score);
void configure(); void configure();
void blink(byte index);
#endif //SUPER_SIMON_UTILS_H #endif //SUPER_SIMON_UTILS_H

View file

@ -65,6 +65,7 @@ bool userSequence(const byte sequence[], byte upTo) {
} }
else { else {
error(); error();
blink(expectedButton);
return false; return false;
} }
} }
@ -98,3 +99,12 @@ void endGame(LiquidCrystal lcd, bool win, byte score) {
lcd.print(score); lcd.print(score);
delay(10000); 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);
}
}