Mechatronics
Documentation for ME 405 labs
Lab0x02

Files

file  Button.py
 Button helper class for grabbing reaction times.
 
file  main.py
 Contains the main state machine for Lab 0x02.
 

Classes

class  Button.Button
 A button class that reports precisely when it is pressed. More...
 
class  main.State
 A class to hold the current state of the FSM. More...
 

Functions

def main.main ()
 Entry point for the Reaction Timing test lab. More...
 

Variables

 main.LD2 = Pin(Pin.cpu.A5, Pin.OUT_PP)
 Global LD2 object for LED.
 
 main.B3 = Pin(Pin.cpu.B3, Pin.IN)
 Global B2 object for interrupt triggering.
 

Detailed Description

Function Documentation

◆ main()

def main.main ( )

Entry point for the Reaction Timing test lab.

This is the entry point to the system control.

Entry point for button rising edge charaterization.

Initialize the FSM and record a reaction whenever it exists. If the User presses CTRL+C (sends a Keyboard Interrupt) then report the average reaction time and exit gracefully.

Wait until the frontend sends the START_DATA_COLLECTION signal, then start collecting data from the user button. Once the FSM indicates that data collection is finished, prune the data and send it back to the frontend with each datapoint timestamped. Time stamps are CSV entries whose first element is time in seconds and second element is voltage in ADC counts.

This function is responsible for running the system including updating the controller, collecting and sending data, and receiving user input.