Kyle Chuang | ME405 Mechatronics Portfolio
Lab0x02: Think Fast! Documentation

Summary

I wrote this code to test the reaction time of the user. A Nucleo L476RG board is required to facilitate this test. When the code is run, 2-3 seconds will pass before the LD2 LED will light up and a timer starts. The timer will end once the user presses the blue USER button, and the reaction time will be reported in seconds. If the user does not press the button within 1 second of the LED being turned on, the light will automatically be turned off, an error message will print, and the run will not be counted.

The trials will repeat for as long as the user pleases. Once the user is done, they can exit the program by pressing "Ctrl + c" on the keyboard. This will exit the program and report the average reaction time from all the trials.