This project was inspired by a YouTube video from Jabrils.
This project is basically a replica of his, though he used a Raspberry Pi and Python to code it. Here are a few pictures of the finished product:
The green PCB on top of the Arduino was designed with EasyEda and I ordered it with JLCPCB, scroll down for a download of the Gerber file.
Once the PCB arrives you should solder all the components on with a soldering iron and solder. It should then be able to slot onto an Arduino just like a shield.
TIP: It is recommended for you to straighten the pins of the push buttons with any tool before trying to insert it into the PCB. The value of the resistors are also printed on their respective spaces (3 x 10K, 1 x 220).
Once you have built the whole board and put it onto the Arduino, you can download the code from below, or just copy and paste it into Arduino IDE. Upload the code onto the Arduino via a USB cable. Now that the code is saved, the usb cable can be swapped for a 2.1 mm DC power cable as the program is already saved onto the Arduino flash memory, though powering the Arduino with the USB cable is also fine.
How to playWhen the program first starts the lights will be flashing back and forth very slowly, keep in mind that the green LEDs might be very dim. Right now the game is in the main menu state. To exit this and start the game, hold any or both of the two buttons in a row with the LEDs for 5 seconds (5 light flashes). All the lights will turn off, then they will all flash 3 times. After this the main game starts.
This is a two-player game, each player controls a button in line with the LEDs. The third button is for restarting the game. The aim of the game is to stop the lights when the opposite green LED from your button turns on, this is done by pressing your button. Reference Jabrils' Video if unclear. If you don't press the button at exactly the right time, the red LED that was on when you pressed the button will stay on for 500 ms. If you do stop at your scoring LED, it will pause the game, and it will flash as many times as your score. Again, keep in mind that the green LEDs can be very dim. It is impossible to score an "own goal". The first to 5 points will win, when this happens, that player's LED will keep flashing, to restart the game, press the button labeled RESTART, or press the Arduino reset button. This will take the game back to the main menu state.
TIP: Sometimes the restart button on PCB might not work, in that case just press the reset button on the Arduino, if nothing happens still, either change a USB port or restart the computer you are drawing power from.
Comments