
Arduino Reaction Time Test Project with LED and Button
In this Arduino project, instructions are provided on how to create a reaction time test using an LED and a button. The project involves wiring the components, explaining the game logic, detailing how the code works, and showcasing a loop function to measure and display reaction times. This project is a fun way to test your reaction speed and improve your Arduino programming skills.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Can you find the 6 this thing Template 1
INTRODUCTION My name is Kavish and today, I ll show you a simple Arduino project that tests your reaction time. The goal is to press a button as fast as you can after an LED lights up. The LED turns on randomly after a delay, and the Arduino measures how quickly you react by calculating the time between the LED turning on and when you press the button. The reaction time is then displayed in milliseconds on the Serial Monitor.
SHOW AND TELL TOPIC Wiring the Components: LED: Connect the long leg (anode) of the LED to a digital pin on the Arduino (pin 13). Connect the short leg (cathode) of the LED to the ground (GND) through a resistor (220 ohms). Push Button: Connect one side of the push button to another digital pin on the Arduino (pin 2). Connect the other side of the push button to ground (GND) via a 10k ohm resistor, to act as a pull-down resistor (this ensures the pin reads LOW when the button is not pressed). Alternatively, you can use the internal pull-up resistor in the Arduino, which would eliminate the need for an external resistor. Game Logic: The game starts when the button is pressed, or automatically at the start of the program. After a random delay, the Arduino will light up the LED. The player must press the button as quickly as possible when the LED turns on. The Arduino will record the time it took from the LED lighting up to the button press. It will then display the reaction time in milliseconds through the Serial Monitor. How the Code Works: The program uses the millis() function to keep track of time. After the random delay, it turns on the LED, waits for the button press, and measures the time elapsed. If the button is pressed, it calculates the reaction time (the difference between the time when the LED turned on and when the button was pressed). Finally, the reaction time is printed to the Serial Monitor for the player to see.
SHOW AND TELL TOPIC P2 void loop() { Code: while (digitalRead(buttonPin) == HIGH) { if (gameStarted == 0) { } const int buttonPin = 2; if (digitalRead(buttonPin) == LOW) { const int ledPin = 13; gameStarted = 1; reactionTime = millis() - startTime; int startTime; Serial.println("Get Ready!"); digitalWrite(ledPin, LOW); int reactionTime; delay(1000); int gameStarted = 0; } Serial.print("Reaction Time: "); } else { Serial.print(reactionTime); void setup() { int delayTime = random(2000, 5000); Serial.println(" milliseconds!"); pinMode(buttonPin, INPUT_PULLUP); delay(delayTime); pinMode(ledPin, OUTPUT); gameStarted = 0; Serial.begin(9600); digitalWrite(ledPin, HIGH); delay(2000); } startTime = millis(); } }
THANK YOU!