This class implements a motor driver for the ME405 board. More...
Public Member Functions | |
| def | __init__ (self, pin_ch1, pin_ch2, timer) |
| Creates a motor driver by initializing GPIO pins and turning the motor off for safety. More... | |
| def | disable (self) |
| Disable the motor and set its speed to zero. More... | |
| def | set_duty (self, duty) |
| Set the motor duty cycle. More... | |
Public Attributes | |
| ch1 | |
| Forward direction PWM channel. | |
| ch2 | |
| Reverse direction PWM channel. | |
This class implements a motor driver for the ME405 board.
| def drivers.Motor.Motor.__init__ | ( | self, | |
| pin_ch1, | |||
| pin_ch2, | |||
| timer | |||
| ) |
Creates a motor driver by initializing GPIO pins and turning the motor off for safety.
| pin_ch1 | A pyb.Pin object to use as the input to half bridge 1. |
| pin_ch2 | A pyb.Pin object to use as the input to half bridge 2. |
| timer | A pyb.Timer object to use for PWM generation on either pin. |
| def drivers.Motor.Motor.disable | ( | self | ) |
Disable the motor and set its speed to zero.
Caution: this method will disable any motors attached to its enable pin.
| def drivers.Motor.Motor.set_duty | ( | self, | |
| duty | |||
| ) |
Set the motor duty cycle.
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 integer holding the duty cycle of the PWM signal sent to the motor |