Lucas Murray ME 305 Portfolio
|
A motor class for one channel of a driver object. More...
Public Member Functions | |
def | __init__ (self, PWM_tim, IN1_pin, IN2_pin, chA, chB) |
Initializes and returns an object associated with a DC Motor. More... | |
def | setDuty (self, duty) |
Set the PWM duty cycle for the motor channel. More... | |
def | killMotor (self) |
A function only used for testing to set motor speed back to zero quickly. | |
Public Attributes | |
t3chA | |
t3chB | |
A motor class for one channel of a driver object.
Objects of this class can be used to apply Pulse-Width Modulation (PWM) to a given DC motor, changing the duty cycle.
def motor.Motor.__init__ | ( | self, | |
PWM_tim, | |||
IN1_pin, | |||
IN2_pin, | |||
chA, | |||
chB | |||
) |
Initializes and returns an object associated with a DC Motor.
PWM_tim | The timer associated with the board motors |
IN1_pin | The first pin associated with the motor |
IN2_pin | The second pin associated with the motor |
chA | The first channel associated with the motor |
chB | The second channel associated with the motor |
def motor.Motor.setDuty | ( | self, | |
duty | |||
) |
Set the PWM duty cycle for the motor channel.
This method sets the duty cycle to be sent to the motor to the given level. Positive values cause effort in one direction, negative values in the opposite direction.
duty | A signed number holding the duty cycle of the PWM signal sent to the motor. |