Ball Balancer Project
|
A motor class for one channel of the DRV8847. More...
Public Member Functions | |
def | __init__ (self, PWM_tim, IN1_pin, IN2_pin, motorNum) |
Initializes and returns an object associated with a DC Motor. More... | |
def | set_duty (self, duty) |
Set the PWM duty cycle for the motor channel. More... | |
Public Attributes | |
IN1 | |
IN2 | |
chanA | |
chanB | |
timch1 | |
timch2 | |
A motor class for one channel of the DRV8847.
Objects of this class can be used to apply PWM to a given DC motor.
def motor.Motor.__init__ | ( | self, | |
PWM_tim, | |||
IN1_pin, | |||
IN2_pin, | |||
motorNum | |||
) |
def motor.Motor.set_duty | ( | 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 |