Sets up methods required to control a motor. More...
Public Member Functions | |
| def | __init__ (self, timer, nSLEEP_pin, IN1_pin, IN2_pin, channel_A, channel_B) |
| Sets up pins and timers for two motors (1 and 2). More... | |
| def | enable (self) |
| Sets the motors enable pin to high, allowing operation. | |
| def | disable (self) |
| Sets the motors enable pin to low, disabling operation. | |
| def | set_duty (self, duty) |
| Adjusts the motors duty cycle based on input parameter. More... | |
Public Attributes | |
| enable_pin | |
| M1_pos | |
| M1_neg | |
| timer1 | |
| M1CH1 | |
| M1CH2 | |
Sets up methods required to control a motor.
The Motor Driver class allows the user to set up two motors using the init method. This method assigns the appropriate pins, timers, and channels required by the motors. The class also includes the enable and disable methods which set the motors enable pin either to high or low. Finally the set duty method allows the user to input a desired motor duty cycle after it has been enabled.
| def Motor_Driver.MotorDriver.__init__ | ( | self, | |
| timer, | |||
| nSLEEP_pin, | |||
| IN1_pin, | |||
| IN2_pin, | |||
| channel_A, | |||
| channel_B | |||
| ) |
Sets up pins and timers for two motors (1 and 2).
| timer | A timer object used PWM generation on inputs 1,2. @parram nSLEEP_pin A pin object used to define enable pin. |
| IN1_pin | A pin object used to define half bridge input 1. |
| IN2_pin | A pin object used to define half bridge input 2. |
| timer | A timer object used PWM generation on inputs 1,2. |
| channel_A | Defines the channel for the IN1 pin |
| channel_B | Defines the channel for the IN2 pin |
| def Motor_Driver.MotorDriver.set_duty | ( | self, | |
| duty | |||
| ) |
Adjusts the motors duty cycle based on input parameter.
| duty | A signed integer holding PWM signal duty cycle. |