ME 305 Website by Cole Sheedy
userInterfaceFrontW2.py File Reference

User interface script for data collection and reception from Nucleo. More...

Functions

def userInterfaceFrontW2.gCallback (key)
 Callback function for the 'g' key release. More...
 
def userInterfaceFrontW2.sCallback (key)
 Callback function for the 's' key press. More...
 
def userInterfaceFrontW2.pCallback (key)
 Callback function for the 'p' key press. More...
 
def userInterfaceFrontW2.dCallback (key)
 Callback function for the 'd' key press. More...
 
def userInterfaceFrontW2.zCallback (key)
 Callback function for the 'z' key press. More...
 

Variables

 userInterfaceFrontW2.last_key = None
 Keeping track of last key actuated.
 
int userInterfaceFrontW2.n = 0
 Counting variable.
 
list userInterfaceFrontW2.dataSet = []
 Housing for data before it is cleaned.
 
 userInterfaceFrontW2.times = array('f', [])
 Time data that is read in through serial.
 
 userInterfaceFrontW2.values = array('f', [])
 Data values that are read in through serial.
 
 userInterfaceFrontW2.ser = serial.Serial(port='COM9',baudrate=115273,timeout=.25)
 Serial object to communicate through VCP port.
 
 userInterfaceFrontW2.gCallback
 
 userInterfaceFrontW2.sCallback
 
 userInterfaceFrontW2.pCallback
 
 userInterfaceFrontW2.dCallback
 
 userInterfaceFrontW2.zCallback
 
 userInterfaceFrontW2.value = ser.readline().decode()
 Individual line read from Nucleo containing time and value, or a string statement.
 
 userInterfaceFrontW2.positionValue = value
 Position value recieved from Nucleo.
 
 userInterfaceFrontW2.deltaValue = value
 Delta value recieved from Nucleo.
 
 userInterfaceFrontW2.zeroText = value
 Message saying the encoder has been zeroed.
 
 userInterfaceFrontW2.newline
 Assists in writing to .csv.
 
 userInterfaceFrontW2.writer = csv.writer(csvfile)
 CSV writer object that can use .writerow to write into my CSV file.
 

Detailed Description

User interface script for data collection and reception from Nucleo.

This is the main script the user will use while simultaneously running encoder and UI backend task files on the Nucleo. This script will read the data that the Nucleo sends us, clean it up, plot time vs. value, then write all the data to empty dataCollection.csv or user can easily change to write to their desired file.
Source code files and related ones:
mainW2.py https://bitbucket.org/ColeSheedy/me-305-work-repository/src/master/LabWork/Lab5.1/mainW2.py
userInterfaceFrontW2.py https://bitbucket.org/ColeSheedy/me-305-work-repository/src/master/LabWork/Lab5.1/userInterfaceFrontW2.py
shareW2.py https://bitbucket.org/ColeSheedy/me-305-work-repository/src/master/LabWork/Lab5.1/shareW2.py
UITaskW2.py https://bitbucket.org/ColeSheedy/me-305-work-repository/src/master/LabWork/Lab5.1/UITaskW2.py
encoderTaskW2.py https://bitbucket.org/ColeSheedy/me-305-work-repository/src/master/LabWork/Lab5.1/encoderTaskW2.py
encoderDriverW2.py https://bitbucket.org/ColeSheedy/me-305-work-repository/src/master/LabWork/Lab5.1/encoderDriverW2.py

UI Front End Finite State Machine Diagram
Author
Cole Sheedy
Date
3/4/2021

Function Documentation

◆ dCallback()

def userInterfaceFrontW2.dCallback (   key)

Callback function for the 'd' key press.

If user presses the 'd' key down, the keyboard function will be enabled. We will use this callback function to send the letter 'd' to the Nucleo to print the corrected delta value of the encoder.

◆ gCallback()

def userInterfaceFrontW2.gCallback (   key)

Callback function for the 'g' key release.

If user presses the 'g' key down, the keyboard function will be enabled. We will use this callback function to send the letter 'g' to the Nucleo to start data collection when the user decides to.

◆ pCallback()

def userInterfaceFrontW2.pCallback (   key)

Callback function for the 'p' key press.

If user presses the 'p' key down, the keyboard function will be enabled. We will use this callback function to send the letter '' to the Nucleo to print the position of the encoder.

◆ sCallback()

def userInterfaceFrontW2.sCallback (   key)

Callback function for the 's' key press.

If user presses the 's' key down, the keyboard function will be enabled. We will use this callback function to send the letter 's' to the Nucleo to start data collection when the user decides to.

◆ zCallback()

def userInterfaceFrontW2.zCallback (   key)

Callback function for the 'z' key press.

If user presses the 'z' key down, the keyboard function will be enabled. We will use this callback function to send the letter 'z' to the Nucleo to zero the position of the encoder.