ME 305 Group 6 Documentation
|
A motor class for one channel of the DRV8847. More...
Public Member Functions | |
def | __init__ (self, pyb.Timer PWM_tim, pyb.Pin IN1_pin, pyb.Pin IN2_pin, int timChannel1, int timChannel2) |
Initializes and returns an object associated with a DC Motor. More... | |
def | set_duty (self, duty) |
Set this PWM duty cycle for the motor channel. More... | |
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_04.Motor_04.__init__ | ( | self, | |
pyb.Timer | PWM_tim, | ||
pyb.Pin | IN1_pin, | ||
pyb.Pin | IN2_pin, | ||
int | timChannel1, | ||
int | timChannel2 | ||
) |
Initializes and returns an object associated with a DC Motor.
Objects of this class should not be instantiated directly. Instead create a DRV8847 object and use that to create Motor objects using the method DRV8847.motor() Must specify correct timer channel to work with IN2_pin
PWM_tim | Passes in a timer object for generating the PWM signal. |
IN1_pin | The first input pin for this motor. |
IN2_pin | The second input pin for this motor. |
timChannel1 | The first timer channel for the motor, attached to IN1_pin |
timChannel2 | The second timer channel for the motor, attached to IN2_pin |
def motor_04.Motor_04.set_duty | ( | self, | |
duty | |||
) |
Set this 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 PWN signal sent to the motor |