Introduction: Arduino Reaction Time Tester
This is a simple reaction time tester. It will randomly turn on a L.E.D. and measure the time it takes you to press a button and then send the measurement to your computer.
Step 1: Materials
Step 2: Making the Circuit
Start by connecting one leg of the button to the positive rail on the bread board. Next, add the 10K resistor between the other leg and ground. Then, add a led between pin 13 on the arduino and ground. After that, connect the negative rail on the bread board to the ground on the arduino and the positive rail to 5V. Finally, connect the leg of the push button with the 10K resistor to pin two on the arduino.
Step 3: Upload the Sketch
Copy and paste the sketch into arduino IDE and upload to the arduino.
int switchPin = 2;
int ledPin = 13 ;
boolean lastButton = LOW;
boolean currentButton = LOW;
boolean Started = false;
boolean timer = false;
boolean debounce(boolean last)
boolean current = digitalRead(switchPin);
if(last != current)
current = digitalRead(switchPin);
currentButton = debounce(lastButton);
if(lastButton == LOW && currentButton == HIGH)
Started = !Started;
lastButton = HIGH;
lastButton = currentButton;
if(Started == true && timer == false)
timer = true;
if(Started == false && timer == true)
timer = false;
randomTime = random(4,10);
randomTime = randomTime*1000;
startTime = millis();
endTime = millis();
elapsedTime = (endTime - startTime)+5;
elapsedTime = elapsedTime/1000;
Serial.print("Time Seconds: ");
Step 4: Test
To use the reaction time tester, plug the arduino into your computer and open the serial monitor. Next, press the button, the L.E.D. should blink once, four to ten seconds later the L.E.D. should turn on. Finally, press the button and the elapsed time from the L.E.D. being turned on to the button being pressed will be displayed on the serial monitor.
We have a be nice policy.
Please be positive and constructive.