First we will cover how to set up the components on a breadboard. Then we will cover the Code used and how it all works. Then i'll show you how you can modify the code to customize the game to your liking.
- Arduino (I used a Nove)
- Bread Board
- Jumper Wires
- 4 different colored LEDs
- 4 100 Ohm Resistors
- 4 Push Buttons
- Small Speaker
Step 1: Hardware setup
First you'll want to lay out your buttons on the bottom section of your Breadboard. We'll tie one lead of the buttons directly to ground. The other lead will be wired to the Arduino's Digital pins 2, 3, 4, and 5. I ran a wire to the top half of the board to keep the wires running from the board to the Arduino out of the way.
Now we want to lay out the LEDs above the buttons. We'll plug the LEDs in with the switches so the Cathode is on the same strip as the side of the button that is tied to ground. Well arrange it so the Anode plugs in off to the side of the button. Now we'll take out 100 Ohm resistor and put it inline with the Anodeto the top section of the breadboard. Now we can connect a wire from the resistor to the Arduino. The LEDs will be using Digital pins 8, 9, 10, and 11. So make sure the buttons and LED are lined up as follows:
- Button on pin 2 with LED on pin 8
- Button on pin 3 with LED on pin 9
- Button on pin 4 with LED on pin 10
- Button on pin 5 with LED on pin 11