LED "Simon Says" Game
In this project, we'll be creating a fun "Simon Says" game using an Arduino, four buttons, four LEDs, and a speaker. The game will generate a random sequence of button presses, and the player must repeat the sequence correctly to progress. As the player advances, the sequence becomes longer. If the player presses the wrong button, the game resets. This project is great for beginners looking to learn about Arduino input/output, buttons, LEDs, and sound.
Supplies
Arduino Uno (or compatible board)
4 push buttons (or jumper wires for testing)
4 LEDs (any color)
4 220Ω resistors (for LEDs)
1 Piezo Buzzer or small speaker
Breadboard
Jumper wires
USB cable to connect Arduino to your computer
Prepare the Arduino Board
-Insert the Arduino Uno into your breadboard or connect it via a USB cable to your computer.
-Open the Arduino IDE, select the correct board type and port, and upload the code provided above.
Circuit Setup
Follow the TinkerCAD dIagram above
LEDs:
- Connect each LED to one of the pins 8, 9, 10, 11. Use 220Ω resistors in series with each LED's cathode (shorter leg) to ground (GND).
Buttons:
- Connect one terminal of each button to pins 2, 3, 4, 5.
- Connect the other terminal of each button to GND (ground).
Speaker:
- Connect the positive terminal of the speaker to pin 12 on the Arduino, and the negative terminal to GND.
Test the Game
Please download or copy the following document for code: https://docs.google.com/document/d/1i8gIL5qlzCDOdpkuWUb3u1JOX7SuBDFyF-1BWSPsrLY/edit?usp=sharing
(NOW DOWNLOAD ARDUINO IDE)
After uploading the code, open the Serial Monitor (Tools > Serial Monitor).
Press the buttons according to the sequence generated by the game.
If you press the wrong button, the game will play a failure sound and restart.
Adjustments and Customization
- You can adjust the tone frequencies in the btnNote[] and cheer[] arrays to change the sounds for each button and the success/cheer sound.
- The sequence length increases with each round, and the game will continue until you fail. You can adjust the difficulty by modifying the game logic.
YOU'VE FINISHED!
Conclusion
Congratulations, you've built a fun Simon Says game with Arduino! This project helped you learn about input and output, LEDs, buttons, sound, and random number generation in Arduino. You can customize it further by adding more buttons, changing the difficulty, or even adding a display. Feel free to experiment and modify the game as you like.