Lucas Murray ME 305 Portfolio
|
Interface with quadrature encoders. More...
Public Member Functions | |
def | __init__ (self, pinA, pinB, timNum) |
Constructs an encoder object. More... | |
def | update (self, updatePosition) |
Updates encoder position and delta. More... | |
def | get_position (self) |
Returns the encoder position. More... | |
def | zero (self) |
Resets the encoder position to zero. | |
def | get_delta (self) |
Returns change in position from previous update. More... | |
Public Attributes | |
tim4 | |
position | |
delta | |
currentPosition | |
Interface with quadrature encoders.
Can read and print the position of a quadrature encoder as well as control the update speed for the position.
def encoder.Encoder.__init__ | ( | self, | |
pinA, | |||
pinB, | |||
timNum | |||
) |
Constructs an encoder object.
pinA | The first pin associated with the encoder |
pinB | The second pin associated with the encoder |
timNum | The number of the timer that works for the given pins |
def encoder.Encoder.get_delta | ( | self | ) |
Returns change in position from previous update.
def encoder.Encoder.get_position | ( | self | ) |
Returns the encoder position.
def encoder.Encoder.update | ( | self, | |
updatePosition | |||
) |
Updates encoder position and delta.
Takes the position of the encoder and recalculates it, updating the change in position in the process
updatePosition | The current position of the encoder |