Collects data from Nucleo to computer. More...
Functions | |
def | UI_front2.key_callback (key) |
callback function called when keyboard key has been pressed More... | |
def | UI_front2.getData () |
Initiates UI_data to start collecting data to send back to UI_front. More... | |
def | UI_front2.writeKey (keyLetter) |
writes defined key to nucleo end More... | |
Variables | |
UI_front2.ser = serial.Serial(port='COM5',baudrate=115200,timeout=1) | |
connect to serial port | |
UI_front2.time = array('f', []) | |
Time array that hold data for 30 secs to plot. | |
UI_front2.value = array('f', []) | |
Data array. | |
UI_front2.callback | |
UI_front2.key_callback | |
UI_front2.suppress | |
UI_front2.last_key = None | |
turns off keyboard callback | |
UI_front2.fileData = open('UIdata.txt', "w+") | |
Create file base to save .CSV data. | |
def | UI_front2.stringList = getData() |
read values from UART and load into string | |
def | UI_front2.stripList = stringList.strip() |
Strip String. | |
def | UI_front2.splitList = stripList.split(',') |
split the stripped string | |
UI_front2.num1 | |
stores numbers, num 1 is time and num 2 is value | |
UI_front2.num2 | |
Collects data from Nucleo to computer.
Implements a system to open and run python file in Spyder that acts as the UI front end. In the Spyder console, the following commands perform different actions: Press 'G' encoder 1 data collection for 30 sec. Press 'F' encoder 2 data collection for 30 sec. \nPress 'S' to end encoder 1 data prematurely. Press 'L' to end encoder 2 data prematurely.\nPress 'Z' to zero the encoder 1 position. Press 'A' to zero the encoder 2 position.\nPress 'P' to print out the encoder 1 position Press 'O' to print out the encoder 2 position.\nPress 'D' to print out encoder 1 delta. Press 'T' to print out encoder 2 delta. The data collected is stored in a local array on local and transmitted as a batch to the laptop and saved within a .CSV. Plots the data in the PC using the matplotlib module.
The link to the code can be found here: https://bitbucket.org/mzaman01/me305_labs/src/master/Lab0xFF2/UI_front.py
def UI_front2.getData | ( | ) |
Initiates UI_data to start collecting data to send back to UI_front.
Sends 'G' for encoder 1 or 'F' for encoder 2 to the UI_data class to start running through the data. The data sent back is transferred into a string to be processed.Timeout is created if nothing is returned.
def UI_front2.key_callback | ( | key | ) |
callback function called when keyboard key has been pressed
key | input to trigger or turn off callback |
def UI_front2.writeKey | ( | keyLetter | ) |
writes defined key to nucleo end
keyLetter | the key to write to nucleo |