The Motor class sets the power of a brushed, dc motor using PWM.
More...
|
| def | __init__ (self, nSLEEP_pin, IN1_pin, IN1_ch, IN2_pin, IN2_ch, timer) |
| | A method to initialize a Motor object. More...
|
| |
|
def | enable (self) |
| | A method to enable the motor by pulling the sleep pin high.
|
| |
|
def | disable (self) |
| | A method to disable the motor by pulling the sleep pin low.
|
| |
| def | set_duty (self, duty) |
| | A method to set the duty cycle of the motor. More...
|
| |
|
|
| nSLEEP |
| | The pyb.Pin object that enables and diables the motor.
|
| |
|
| timer |
| | The pyb.Timer object used to generate PWM for the motor.
|
| |
|
| IN1 |
| | The channel of the PWM timer corresponding to the first motor lead.
|
| |
|
| IN2 |
| | The channel of the PWM timer corresponding to the second motor lead.
|
| |
The Motor class sets the power of a brushed, dc motor using PWM.
◆ __init__()
| def motorDriver.Motor.__init__ |
( |
|
self, |
|
|
|
nSLEEP_pin, |
|
|
|
IN1_pin, |
|
|
|
IN1_ch, |
|
|
|
IN2_pin, |
|
|
|
IN2_ch, |
|
|
|
timer |
|
) |
| |
A method to initialize a Motor object.
- Parameters
-
| nSLEEP_pin | The pyb.Pin object that enables and diables the motor. |
| IN1_pin | The pyb.Pin object connected to one lead of the motor. |
| IN2_pin | The pyb.Pin object connected to the other lead of the motor. |
| IN1_ch | The channel number of the PWM timer corresponding to IN1_pin. |
| IN2_ch | The channel number of the PWM timer corresponding to IN2_pin. |
| timer | The pyb.Timer object used to generate PWM for the motor. |
◆ set_duty()
| def motorDriver.Motor.set_duty |
( |
|
self, |
|
|
|
duty |
|
) |
| |
A method to set the duty cycle of the motor.
- Parameters
-
| duty | The duty cycle to set the motor to, from -100 to 100. |
The documentation for this class was generated from the following file: