This is the Arduino version of the classic 'Simon Says' game, whereby the game is to repeat the sequence of colours/tones that are shown/played by the controller. Each time the game starts, the user pushes one of the buttons corresponding to each colour to select one of four difficulty levels to play. These range from white (easy) over green (medium) to yellow (hard) and red (very hard). Pushing a button longer resets the highscore for that level. Once a level is selected, the controller plays a random sequence, each time increasing in length. The user remembers the sequence and pushes the corresponding buttons. The game continues as long as the user enters a correct sequence. When the wrong button is pressed, the game ends. A winning tone is played when the highscore for that level is broken, a losing tone otherwise. In case a serial output monitor is connected, the menu and results are also shown. The electrical circuit uses three 150 ohm resistors for the green, yellow, and red LEDs, one 2K2 ohm resistor for the white LED, and four 10K ohm resistors for the push buttons. There is another 2K2 ohm resistor for the speaker to attenuates its loudness more. To play music, we use the SimpleTunePlayer library. The highscores are stored in the Arduino's EEPROM memory, so that they are remembered after powering off.
Demonstration of game (mp4, 73.7 MiB)
Electrical diagram:
Assembled and soldered protoshield: