diff --git a/arduino/msaqsg/ch03/DiceGame/DiceGame.ino b/arduino/msaqsg/ch03/DiceGame/DiceGame.ino index e2ebcbe..00e4510 100644 --- a/arduino/msaqsg/ch03/DiceGame/DiceGame.ino +++ b/arduino/msaqsg/ch03/DiceGame/DiceGame.ino @@ -7,8 +7,11 @@ const unsigned int LED_BIT2 = 12; const unsigned int START_BUTTON_PIN = 5; const unsigned int GUESS_BUTTON_PIN = 7; const unsigned int BAUD_RATE = 9600; - const unsigned int DEBOUNCE_DELAY = 20; +const unsigned int HOORAY_FLASHES = 10; +const unsigned int HOORAY_FLASH_BATCHES = 3; +const unsigned int HOORAY_FLASH_BATCH_PAUSE = 200; +const unsigned int HOORAY_FLASH_DURATION = 50; Bounce startButton = Bounce(); Bounce guessButton = Bounce(); int guess = 0; @@ -20,11 +23,14 @@ void outputResult(const long result) { } void hooray() { - for (unsigned int i = 0; i < 3; i++) { - outputResult(7); - delay(500); - outputResult(0); - delay(500); + for (unsigned int i = 0; i < HOORAY_FLASH_BATCHES; i++) { + for (unsigned int i = 0; i < HOORAY_FLASHES; i++) { + outputResult(7); + delay(HOORAY_FLASH_DURATION); + outputResult(0); + delay(HOORAY_FLASH_DURATION); + } + delay(HOORAY_FLASH_BATCH_PAUSE); } }