ARDUINO MEMORY GAME
This project is all about testing how strong your memory it.
This version of the Memory Game challenges you to recall randomly generated sequences of the 4 LEDs. Using the buttons, the user will input their answer.
If the answer is wrong or they run out of time, then the RGB led will light up red and the game will restart. Accompanied with the red RGB LED lighting up will be a mini ‘song’ using the Piezo buzzer that lets the user know that they lost.
Once the user has inserted the right answer for all the rounds, the RGB LED will light up blue which will be accompanied with a mini ‘song’ announcing the victory.
Each round number will be displayed using a 7-Segment Display.
Step 1: Parts Required
- Arduino Uno
- Bread Board
- RDG LED (The one used in this project is Common Anode (CA))
- LED (Green, Blue, Red, Yellow)
- Piezo buzzer
- 7 Segment Display (The one used in this project is Common Anode (CA))
- 4 Buttons (one for each LED Green, Blue, Red, Yellow)
- 4x 10k resistors (used for the buttons)
- 4x 330 ohm resistors (used for the LEDs)
- 3x 560 ohm resistors (used for the RGB LED and 7 Segment Display)
Step 2: Wiring
Here are some picture of how the wiring is suppose to look.
Since there were not though pins for all the components, the analog pins (A0 - A5) where used as output pins for the 7 Segment Display.
In the RGB LED only the red and blue pin where required which is why only those 2 RGB pins are attached to the Arduino. The Green RGB pin does NOT have an Arduino pin and is given power as it the component is a Common Anode.
Step 3: Upload the Code
This game consists of 4 different coloured LEDs, 4 buttons and a RGB led, a piezo buzzer and a 7-segment display. How it works is that the code generates a random order that the user has to remember and input using the buttons.
To start the game u press any button. While the sequence is being played on the LEDs there is a musical note being played along side it. This also happens when the user goes to use the buttons. This enhances the game as it makes it a visual and auditory memory game.
The RGB LED let’s the player know if they got the answer wrong, if they an out of time or or if they successful finished the game. Once you go through the entire sequence the RGB led lights up blue to let you know that you have successfully finished the game and a victory song is played through the buzzer. If you get the answer wrong it will restart the entire game. It will also restart the entire game if you run out time. You have be to press a button in 5 seconds time. If you get the answer wrong or run out of time a song that lets u know that you have lost.
In this game particularly, there are 5 rounds in total to win the entire game that are displayed through the 7 segment display.
Click on the file to download the code.
The code written in Arduino and includes comments to understand the code better
Downloads
Step 4: Video of Memory Game Working
Here is a video of the memory game.
I did this for my final project in class and it was really fun to create.
Hope you like it!
Happy Tinkering!