Arduino LED Memory Game

by umairQ in Circuits > Arduino

298 Views, 2 Favorites, 0 Comments

Arduino LED Memory Game

unnamed.jpg

TinkerCAD


LEDs flash in increasingly long sequences and the objective is to select the LEDs in the correct order to advance to the next round. 


The first push button allows you to select an LED, and the second one confirms your selection. Choosing the wrong LED ends the game and pressing the first push button starts a new game.


Read to the end for additional features you can add to your memory game.

Supplies

unnamed.jpg

Place the Components on the Breadboard

unnamed.jpg
unnamed.jpg
unnamed.jpg
unnamed.jpg

First, place the 5 LEDs side by side on the breadboard. Ensure that the longer leg (the anode) of each LED is on the right.


Next, place 5 330/560Ω resistors, with each connected to the anode of one LED. Remember to cut the resistors short if needed to prevent push buttons from being unstable later.


Then, place 3 push buttons side by side with their 10KΩ resistors connected to their bottom right legs and ground.


Finally, place the 7 Segment display and a 330/560Ω resistor connected to power.

Wiring

unnamed.jpg
unnamed.jpg
unnamed.jpg
unnamed.jpg

First, connect the left leg (cathode) of each LED to ground and the bottom left leg of each push button to ground.


Next, connect the anode of each LED to the Arduino through the previously placed resistors.


Then, connect the top right leg of each push button to the Arduino.


Finally, connect each leg of the 7 segment display to the Arduino.

Upload the Code to the Arduino

The code can be found below. The comments clarify how different parts of the code work. Keep in mind that you will have to change the pin numbers in the code if you used different pins than the ones used in the images.

Additional Features

pasted image 0.png

You can add so much more to your memory game. Some of the features I added were:


  • An RGB LED that turns purple
  • A potentiometer that controls the speed of the game
  • Another mode where the LEDs flash automatically without needing to press the second button
  • Removing the first button and giving its functionality to the second button
  • Building the whole project on a smaller breadboard

Video of the Project Working

Video