Arduino LED Reaction Time Game: Tutorial

by RajbirB in Circuits > Electronics

2661 Views, 6 Favorites, 0 Comments

Arduino LED Reaction Time Game: Tutorial

IMG_1723.jpg

Instructions:

The project's main controls that the player interacts with are pressing the 3 push buttons to play. The goal is to press the button that corresponds to the turned-on yellow LED as fast as you can. The green LEDs indicate the next yellow LED. When the song finishes, your score will appear on the red LED. If the LED is blinking then that means you win the game and if it does not blink that means you failed. Make sure to press the buttons enough for the input to be accepted. This project is meant for those who have some experience with being able to cut wires and basic circuit knowledge.

In this instructable you will find the following:

  • Code
  • Materials list
  • Schematic
  • TinkerCad

Think I missed anything? Leave a comment below!

Materials

Tools.png

Getting Started!

IMG_1723.jpg
IMG_1724.jpg
IMG_1722.jpg
Capture1.JPG

Although the project might look scary and really complicated in this step-by-step instructable you will have this project looking better than mine! For this project, you will also be required to download the Arduino software. The link to the software can be found here.

Code

Port.png

For this project, you will also need to be able to plug your Arduino into the computer. Once you have plugged the Arduino into the computer and opened the software go to tools on the top right and select ports. Make sure that your Arduino UNO is showing on the port. After you have done so you can copy and paste the code that is provided with the TinkerCad. Next, click the arrow in the top left and save your work. The code starts by defining all the pins into variables and what type of pin it is (digital or analog). the song is put into an array as a set of 3, which is the tone delay and pitch. When the game starts each tone is only played if the button that corresponds to the yellow LED is pressed. If this is true then the buzzer will play the tone. If the wrong button gets pressed then the 555 Timer is activated by giving it power. The 555 timer has no coded parts and is used to blink the LED. If the correct button is pressed then the 555 timer will not get any power meaning the LED will not blink or turn on. If the wrong button is pressed then the penalty will be added to the score. If the player completes the song they will get the LED to blink at the end.

Downloads

Wiring Diagram

Capture.JPG
Capture1.JPG

Now it's time for the wiring! All that's left is putting the components and wires in their spot. The diagram above shows you exactly where each wire and component should go. While wiring makes sure to look at every detail and try to make the wiring as neat as possible. If you encounter any errors or if something is not working make sure to see if the wire is in the correct spot. If you want to test the diagram for yourself you can see the TinkerCad in the code section. The components that have no code are the 555 Timer. A 555 timer adds a delay between the voltage getting to the red LED. This creates a blinking effect. Have fun with your game and show it to all your friends!

Summary

Arduino LED Reaction time game

You did it congratulations. In this project, you learned how to wire a 555 timer and make a piano at the same time!. Here is a clip of the final working piece. Some problems that may occur with the game are that the buttons pop out and it gets annoying however, replacing the button might fix the problem. Thank you for reading and enjoy