This activity is a Human Response Timer using the RT-Spark Development Board. The system uses an RGB LED and a push button to measure a person's reaction time.
The program starts by waiting for a random amount of time before turning on the LED. Once the LED lights up, the user must press the button as quickly as possible. The microcontroller then records the response time using a counter. An interrupt is used to detect the button press and stop the counting process.
First, the hardware connections were prepared according to the given schematic diagram. The push button was configured as the input device, while the RGB LED was configured as the output device.
GPIOConfiguration
The GPIO pins for the LED and push button were configured using STM32CubeMX. The button pin was set as an external interrupt, while the LED pins were configured as output pins.
Enable the Random Number GeneratorThe Random Number Generator (RNG) peripheral was enabled. This was used to create a random delay between 1 and 3 seconds before the LED turned on.
Video DemoThis video shows the Human Response Timer in action. The LED turns on after a random delay, and the user's button press is detected through an interrupt to measure reaction time.
Display the ResultThe RGB LED indicates the result based on the counter value:
- Green LED – Fast response
- Red LED – Average response
- Blue LED – Slow response






Comments