ME405: Mechatronics
Project Documentation and Portfolio by Neil Patel
lab2a.py File Reference

This file contains a program which tests a user's reaction time. More...

Namespaces

 Lab0x02
 This package contains lab2a.py, lab2b.py.
 

Functions

def lab2a.record_time ()
 Function that keeps track of time and displays the reaction time of the user on a button press. More...
 

Variables

 lab2a.blinko = pyb.Pin(pyb.Pin.board.PA5, mode=pyb.Pin.OUT_PP)
 Initializes LED, interrupt on the User button, and code to run the program to test a user's reaction time.
 
 lab2a.pinc13 = pyb.Pin (pyb.Pin.board.PC13, pyb.Pin.IN)
 
list lab2a.tries = []
 Keeps track of all the attempts.
 

Detailed Description

This file contains a program which tests a user's reaction time.

Function Documentation

◆ record_time()

def lab2a.record_time ( )

Function that keeps track of time and displays the reaction time of the user on a button press.

This program waits for a time interval between 2 and 3 seconds and then turns on the green LED on the Nucleo. It then records the time difference between the lighting up of the LED and the User button press (if any) and displays the reaction time on the terminal. The green LED stays on for just 1 second.

Returns
Returns nothing.