Class for utilizing motors. More...
Public Member Functions | |
def | __init__ (self, sleepPin, pin1, pin2, ChA, ChB, timerNumber) |
Motor initializer. More... | |
def | set_duty (self, duty) |
Sets the motor to a particular PWM. More... | |
def | enable (self) |
Enables the motor to be controlled. | |
def | disable (self) |
Disables the motor from being controlled. | |
Public Attributes | |
sleepPin | |
Sleep Pin for motor. | |
pin1 | |
Pin 1 for motor input. | |
pin2 | |
Pin 2 for motor input. | |
tim | |
Timer which the motor is on. | |
tim_ch1 | |
Channel object for input 1 for motor. | |
tim_ch2 | |
Channel object for input 2 for motor. | |
Class for utilizing motors.
This motor class uses PWM through two pins to actuate a motor. It also relies on a sleepPin being enabled, being on the correct timer, and channels.
def motorDriverW4.motor.__init__ | ( | self, | |
sleepPin, | |||
pin1, | |||
pin2, | |||
ChA, | |||
ChB, | |||
timerNumber | |||
) |
Motor initializer.
This motor initializer requires a sleepPin, then two pins that are connected to motor, two channels for sending the PWM, and a timerNumber.
def motorDriverW4.motor.set_duty | ( | self, | |
duty | |||
) |
Sets the motor to a particular PWM.
This function turns the motor on and uses if statements to determine which direction to turn the motor. If duty is positive the motor turns CCW, if duty is negative the motor turns CW.