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

This file contains the UI front-end which runs on the PC and receives user input. More...

Namespaces

 Lab0x03
 This package contains UI_front.py, main.py.
 

Functions

def UI_front.kb_cb (key)
 Callback function which is called when a key has been pressed. More...
 
def UI_front.sendVals ()
 Callback function which is called when a key has been pressed. More...
 

Variables

 UI_front.ser = serial.Serial(port = 'COM5', baudrate = 115200, timeout = 5)
 Implementation of serial communication.
 
string UI_front.last_key = ''
 The input key pressed by the user.
 
 UI_front.time = array.array('f')
 Array keeping track of time stamps.
 
 UI_front.data = array.array('f')
 Array keeping track of ADC counts.
 
 UI_front.file1 = open('voltvstime.csv', 'w')
 
string UI_front.line = "%f, %f\n" % (time[n], data[n])
 

Detailed Description

This file contains the UI front-end which runs on the PC and receives user input.

Function Documentation

◆ kb_cb()

def UI_front.kb_cb (   key)

Callback function which is called when a key has been pressed.

Parameters
keyString representation of the key pressed by the user.
Returns
last_key String representation of the last key pressed by the user, stored as a global variable.

◆ sendVals()

def UI_front.sendVals ( )

Callback function which is called when a key has been pressed.

Waits for the 'G' key press from the user. Once the key is pressed, sends the character over to the Nucleo to signal the start of data capture. Receives the captured data back from the Nucleo™ and arranges it into the time and data arrays.

Returns
Returns nothing.