Introduction: Two Player Reflex Game With Arduino

Photo credit: Portrait of the Gemini 8 prime crew(license)

You've mastered the Reflex Tester 2000. Now you'll experience the next
level in modern-age space flight testing technology: The Reflex Tester 2000 and 1! The latest version allow us to pit hopeful recruits head-to-head and see who's really the best. Report to HQ and get to work.

Example of the finished game:

Step 1: Gather Materials

To make a reflex tester 2001, you'll need the following items:

1 Arduino UNO

3 Buttons

13 Jumper Wires

1 Breadboard

3 LEDs

1 USB B Cable

3 10k Resistors

Step 2: Assemble the Circuit 1

Follow the image above to connect power from the Arduino to both rails on each side of the breadboard.

Step 3: Assemble the Circuit 2

Follow the wiring diagram above to hook up the buttons.

Step 4: Assemble the Circuit 3

Follow the wiring guide above to connect the buttons to the pins on the Arduino and the the resistors.

Step 5: Assemble the Circuit 4

Finally, follow the wiring diagram above to hook up the LEDs.

Step 6: Upload the Code

Upload the following code using CodeBender or copy/paste it into the Arduino IDE.

Step 7: Play the Game

Open the serial monitor in CodeBender or the Arduino IDE.

Power up your Arduino, then press the game start button (The button connected to Pin 12.) The start LED (The LED connected to Pin 11) should flash once, this indicates the test has begun.

The next time you see the LED flash, press your button faster than your opponent. The winner's indicator LED will turn on and the serial monitor window will show both player's reaction time and by how much the winning player won by. The system will also keep a running tally of wins.

Step 8: Next Steps

See if you can add features like buzzer noises, penalties for pressing the button too soon, or a best-two-out-of-three system.

For more open source Arduino-based missions and science experiments, visit our lessons page at http://www.ardusat.com.

Comments

author
tcrawford6 (author)2015-11-27

I copied this exactly as you described it and it worked first time! Excellent instructable! I modified the code slightly to measure in microseconds, so that the time difference is reported in milliseconds.

author

Awesome, glad it worked. Would you mind sharing your code so we could add it as an option?

author

I just edited the code in subroutine startGame(), changing the units from 'millis' to 'micros' (lines 93, 100 and 105). That means the reflex times are posted in milliseconds, but it's easier to measure the differences in those units.

author
tomatoskins (author)2015-11-13

Hahaha this is awesome! I'd love to see a video of someone playing it!

About This Instructable

2,227views

15favorites

License:

More by ArdusatCHoffman:Brew the Perfect Cup of Tea with ArduinoWill it Conduct Electricity? with ArduinoTarget Practice with Arduino and Laser Pointer
Add instructable to: