Simulates data collection and transfer through UART port. More...
Public Member Functions | |
def | __init__ (self, collectionDuration=301, collection_frequency=.1) |
Initializes the class. More... | |
def | go (self) |
Runable State Machine for data generation and transfer. More... | |
Public Attributes | |
myuart | |
UART port object. | |
times | |
Array object for the times that will be appended. | |
values | |
Array object for the values of the decaying sine wave function that will be appended. | |
collectionDuration | |
Total number of data points collected. | |
collection_frequency | |
Amount of time in between each data point [seconds]. | |
n | |
Counting variable. | |
state | |
State tracking variable. | |
iteration | |
Iteration variable for prompting. | |
readChar | |
Character read in from User to Nucleo. | |
start_time | |
Start timer for when user types 'g' to start data collection [milliseconds]. | |
timer | |
Timer that counts while data is being generated [seconds]. | |
data | |
Individual data points created from decaying sine wave as a function of time. | |
myLineString | |
String text of time and values formatted as '{:}, {:}\r ' to be sent to user. | |
Simulates data collection and transfer through UART port.
This class does multiple things regarding data. Once the user types 'g', data will begin to generate with the decaying sine wave as a funciton of time. When the user either types 's' or exceeds the decided generation duration time, the data will be formatted such as '{:} , {:}' and then serially transferred to user.
def dataHandlingClassW1.dataHandling.__init__ | ( | self, | |
collectionDuration = 301 , |
|||
collection_frequency = .1 |
|||
) |
Initializes the class.
This class can be initialized with two attributes. CollectionDuration is the total number of data points the user wishes to collect. Collection_frequency is the time you want between each data point generated. If these attributes are multiplied together, you will get the total runtime in seconds if not interrupted.
def dataHandlingClassW1.dataHandling.go | ( | self | ) |
Runable State Machine for data generation and transfer.
In state 1, the Nucleo is waiting on a 'g' key release to exit and begin generating data. Once 'g' is released, state 2 is entered and the Nucleo generates data based off the decaying sine wave function until 's' or until collectionDuration*collection_frequency seconds have elapsed. Once either of those happen, state 3 is entered and the data is slightly formatted and then sent serially through the UART port to the user.