Introduction: Final 11, Accuracy Game
In this intrsuctable, I will be showing you how to create the game shown before you. To explain the basic rules, the button along the LCD screen is used as an start button, once held accordingly, the procedure will start and the game will run for 5 turns(this cant be set to whatever number in the code) before printing your score on the screen. During the turns, LEDs will randomly light green to indicate the specified button to hold. should you have the button held once 3 seconds have passed, the LCD will print "good job", the buzzer will ring a semi high tone, and the RGB LED will turn blue. When you miss, the LCD will print "missed", the buzzer will let out a low tone, and the RGB LED will turn red. now that the rules and concept is explain, let me show you how to build it.
Step 1: Components
The components needed in this circuits will be:
- 1 LCD 16x2
- 1 Arduino Uno R3
- 1 Breadboard
- 1 Potentiometer
- 1 Piezo (Buzzer)
- 4 Green LEDs
- 1 RGB LED
- 6 330 ohm Resistors
- 5 10k ohms Resistors
- 5 Pushbuttons
Step 2: Power and Ground
First, any circuit needs power and ground. start by wiring power and ground to both top and bottom rails, likely as shown.
Step 3: Game Buttons
Next, set up 4 buttons as shown, these will be used to play the game. You will need to have each use a 10k ohm resistor connecting it to ground, as well as 4 wires connecting each button to the Arduino all indicated as shown.
Step 4: LCD Setup
Next, setup the LCD screen which will help you operate the game, and print various messages throughout the game, including counting down each round, and printing score. you will need to connect the wires as shown with 2 wires being ground( one to the led cathode of the LCD and one to the first pin of the LCD indicated as ground) and 1 power (connected to the power pin of the LCD). also, use a 330 ohm resistor to connect the LCD LED anode to the power. you will also need 6 wires input wires connecting the LCD to the Arduino, and 1 wire connecting the LCD to the potentiometer, with all indicated positions as shown in the image.
Step 5: Button LEDs
Now, lets setup the LEDs that will indicate the buttons to be pushed. you will need 4 330 ohm resistors connecting each LED to ground. You will also need 4 wires connecting to the anode of each LED and then back to the Arduino. This will allow the LED to be coded as well as give it the random interval times to light.
Step 6: Piezo and RGB
You will now place the hit, or miss indicators as in the piezo and RGB. These will be used to indicate the stated actions. The piezo will need to simply have 2 wires connected to it. One wire will be connecting the negative pin to ground, while another connects the positive side to the anode. For the RGB, it will need another 330 ohm Resistor which will connect the common cathode to the ground. The RGB will also need 3 wires connecting each LED colour to the Arduino. Note that these wires should connect to any analog pins on the Arduino( indicated with a "~" symbol infront. Also be advised the digital pins in the right side of the Arduino may be used up so you may be forced to use the analog pins on the left of the Arduino(A1,A2,A3,etc.)as shown in the image.
Step 7: Start Button
Finally, you will wire the start button for the game. You will need to use the remaining pushbutton and 10k ohm resistor. Simply connect the button to power with one wire, and use the resistor to connect the button to ground, make sure the ground connection is not connected on the exact opposite of the power(1a-2a) instead, if the power is connected to 1a for example, connect the ground to 1b or 2b. you will also need a connect from the ground path, to the Arduino all as shown in the image.
Step 8: Code
Now that we have the circuit built, here is the code that you will need to make it all run, feel free to explore and change any variable to change the outcome of the game.