nerf-turret 1
Infrared targeting nerf turret
|
This class implements a motor driver for an ME 405 kit. More...
Public Member Functions | |
def | __init__ (self, str en_pin, str in1pin, str in2pin, int timer, int ch1, int ch2) |
Creates a motor driver and configures the appropriate pins, timers, and timer channels. | |
def | enable_motor (self) |
Enables the motor by driving the enable pin high. | |
def | disable_motor (self) |
Disables the motor by driving the enable pin low. | |
def | set_duty_cycle (self, int level) |
Drives the motor at a given duty cycle. | |
This class implements a motor driver for an ME 405 kit.
def motor_driver.MotorDriver.__init__ | ( | self, | |
str | en_pin, | ||
str | in1pin, | ||
str | in2pin, | ||
int | timer, | ||
int | ch1, | ||
int | ch2 | ||
) |
Creates a motor driver and configures the appropriate pins, timers, and timer channels.
en_pin | String containing the pin label of the enable pin (e.g. 'A10' for pin A10) |
in1pin | String containing the pin label of the first PWM channel |
in2pin | String containing the pin label of the second PWM channel |
timer | Number of the timer to configure, given as integer (e.g. 5 for TIM5) |
ch1 | The channel number of the first PWM channel, given as integer (e.g. 1 for TIMx CH1) |
ch2 | The channel number of the second PWM channel, given as integer |
def motor_driver.MotorDriver.set_duty_cycle | ( | self, | |
int | level | ||
) |
Drives the motor at a given duty cycle.
level | PWM duty cycle to drive the motor at. Given as integer from -100 to 100 (inclusive). The sign affects the direction the motor will be driven. |