Encoder task that creates variables for encoder driver functions and parameters. More...
Public Member Functions | |
def | __init__ (self, period, enc_pos, z_flag, enc_delta, encoder_obj) |
Constructs an encoder task. More... | |
def | run (self) |
Runs one iteration of the FSM. | |
Public Attributes | |
period | |
The frequency of the task. More... | |
enc_pos | |
The encoder position that counts total movement. More... | |
z_flag | |
A boolean flag used to reset encoder position to 0. More... | |
encoder_obj | |
The encoder object that calls encoders 1 or 2. More... | |
enc_delta | |
The change in position. More... | |
state | |
Sets initial state to State 1. More... | |
runs | |
Sets the number of runs to 0. More... | |
next_time | |
The utime.ticks_us() value associated with the next run of the FSM. More... | |
Encoder task that creates variables for encoder driver functions and parameters.
Implements a finite state machine that interacts with the encoder driver and task user interface
def Lab4_task_encoder.Task_Encoder.__init__ | ( | self, | |
period, | |||
enc_pos, | |||
z_flag, | |||
enc_delta, | |||
encoder_obj | |||
) |
Constructs an encoder task.
The encoder task is implemented as a finite state machine
period | The period, in microseconds, between runs of the task |
enc_pos | The encoder position that counts total movement |
z_flag | A boolean flag used to reset encoder position to 0 |
enc_delta | The change in time increments in timer count |
encoder_obj | The encoder object that calls encoders 1 or 2 |
Lab4_task_encoder.Task_Encoder.enc_delta |
The change in position.
The difference between two recorded positions of the encoder
Lab4_task_encoder.Task_Encoder.enc_pos |
The encoder position that counts total movement.
The total position moved is characterized by the total number of timer counts
Lab4_task_encoder.Task_Encoder.encoder_obj |
The encoder object that calls encoders 1 or 2.
Encoders 1 or 2 was defined in the main.py file
Lab4_task_encoder.Task_Encoder.next_time |
The utime.ticks_us() value associated with the next run of the FSM.
Defines a variable that adds the period to the ongoing timer
Lab4_task_encoder.Task_Encoder.period |
The frequency of the task.
Defines variable that specifies timer frequency
Lab4_task_encoder.Task_Encoder.runs |
Sets the number of runs to 0.
Defines a variable to keep track of runs
Lab4_task_encoder.Task_Encoder.state |
Sets initial state to State 1.
Starts timer.
FSM starts at State 1, where the update function is called for encoder object
An increasing microsecond counter with an arbitrary reference point
Lab4_task_encoder.Task_Encoder.z_flag |
A boolean flag used to reset encoder position to 0.
When character "z" is pressed on the keyboard, z-flag will be 'True' and reset encoder position