Project 2 – Two Player Advanced Reaction Game

Simon Monk’s Raspberry Pi Electronics Starter Kit Advanced Project 1
Henry Budden
Project 2 – Two Player Advanced Reaction Game
This project will allow you to build a fun two player reaction game so that you
can challenge your friends to a game of speed! Once built, the game includes
trick questions, score keeping and LEDs that display who is winning!
You will need:








Raspberry Pi (fully set up and connected to the internet)
Breadboard
2x Red LEDs
2x Buttons
RGB LED
5x 470Ω Resistors
8x Male to Female Jumper Wires
4x Male to Male Jumper Wires
Instructions:
1. Ensuring that the Raspberry Pi is turned off, make the circuit and
connect it to the Raspberry Pi as shown in the diagram. (Hint: The long
lead of the RGB is inserted into row 15 – shown with a red dot)
0
Simon Monk’s Raspberry Pi Electronics Starter Kit Advanced Project 1
Henry Budden
2. Turn on the Raspberry Pi and install the software using the following
command in LXTerminal:
$ git clone https://github.com/henrybudden/rpesk-advanced
3. Ensure that the files for GPIO Zero are installed on the Pi with the
commands:
$ sudo apt-get update
$ sudo apt-get install python-gpiozero
4. Once the software has downloaded, change directory with the command:
$ cd rpesk-advanced
5. Finally, run the code using the command:
$ sudo python 02_reaction_game.py
How to Play
1. When you run the program, you will first need to type the names of the
two players and press enter each time.
2. Once this is done, you will be prompted on screen to ‘get ready’. Player
one’s button is located at the bottom of the breadboard and player two’s
at the top (as on the previous diagram).
3. When the RGB LED in the centre of the breadboard lights up in any
colour other than red, press your button as fast as you can! The first
player to hit their button once the RGB LED has lit up will gain a point.
4. However, beware! If the RGB LED lights up red, do not press your
button! If you do, one point will be deducted from your score!
5. After each round the score for each player is displayed on the screen,
and the small red LEDs on the breadboard will light up on the side of the
player in the lead. If both LEDs are lit up, you are tied.
6. Each round will begin automatically, so keep going until you get too
tired!