Intro: Reaction Time Game With Arduino Uno
Here is a side project I made for fun, a step-by-step tutorial on how to make a two-player game with the Arduino Uno. It involves testing players' response times and seeing who is faster at pressing the corresponding button when an LED lights up.
Step 1: Materials Needed
1 Arduino Uno
4 LEDs of different colors
4 10 ohm resistors
5 100K ohm resistors
20 jumper cables
Step 2: The Circuit: Basics
The circuit is very simple; all you need to know how to do is to connect LEDs and buttons like they are arranged in the simplified diagram below.
The LED has a long and a short leg. The short leg is "negative" and the long leg is "power" and "signal". The LED's negative, or "ground", leg can be attached to the negative line on the breadboard with a 10 ohm resistor. The positive leg of the LED must be connected to the positive line on the breadboard and plugged into a digital port on the Arduino board. This wire is how you can tell it to turn on or off.
The button is connected to power and ground (on the breadboard) via a pair of adjacent pins on the button itself. On the other side, one pin needs to be connected to the Arduino. The button should be connected to ground with a 100k ohm resistors.
On the top is a basic circuit diagram for wiring up LEDs and buttons. The second picture is what one player's "console" looks like.
Step 3: Build the Actual Setup
This is the setup for making a two-player game, with each person having their own two LEDs and own breadboard to hold as a "gaming console". The button that is in the middle is the start button for the game.
Edit 6/5/17 6:22 pm: I just realized I forgot to connect the ground and power to the rightmost breadboard as well; I will fix the diagram tomorrow. Sorry for any confusion!
Step 4: Code
Download the code below and connect the Arduino to the computer. Compile and open the Serial Monitor in the top menu under Tools to begin to play.
If you have difficulty downloading it, you can copy and paste the code in this document:
Step 5: Play!
Challenge a friend to a speed duel and see your results in the Serial Monitor!
You may have to turn off auto scrolling at the bottom left corner to see your results.