Public Member Functions | |
| def | __init__ (self, IN1_pin, IN2_pin, IN_timer, ch1, ch2, mChFlag=False) |
| Creates a motor driver channel object by initializing GPIO pins. More... | |
| def | setLevel (self, level) |
| Set the level of the motors. More... | |
Public Attributes | |
| IN_timer | |
| The timer for the motors. More... | |
| IN1_pin | |
| The timer channel object for half bridge 1 of the motor. More... | |
| IN2_pin | |
| The timer channel object for half bridge 2 of the motor. More... | |
| mChFlag | |
| Debugging flag for detailed analysis while running. | |
| def motorDriverChannel.motorDriverChannel.__init__ | ( | self, | |
| IN1_pin, | |||
| IN2_pin, | |||
| IN_timer, | |||
| ch1, | |||
| ch2, | |||
mChFlag = False |
|||
| ) |
Creates a motor driver channel object by initializing GPIO pins.
Example:
self.motX = self.motorDriverObj.channel(Pin.cpu.B0, Pin.cpu.B1, Timer(3, freq=20000), 3, 4, mChFlag = False)
| IN1_pin | First PWM pin object |
| IN2_pin | Second PWM pin object |
| IN_timer | A pyb.Timer object with correct timer number and frequency |
| ch1 | First timer channel number |
| ch2 | Second timer channel number |
| mChFlag | Debugging flag |
| def motorDriverChannel.motorDriverChannel.setLevel | ( | self, | |
| level | |||
| ) |
Set the level of the motors.
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.
| level | A signed integer holding the new duty cycle of the PWM signal sent to the motor. |
| motorDriverChannel.motorDriverChannel.IN1_pin |
The timer channel object for half bridge 1 of the motor.
This timer channel will be set to PWM in order to control the quadrature encoders at a specified channel number
| motorDriverChannel.motorDriverChannel.IN2_pin |
The timer channel object for half bridge 2 of the motor.
This timer channel will be set to PWM in order to control the quadrature encoders at a specified channel number
| motorDriverChannel.motorDriverChannel.IN_timer |
The timer for the motors.
This is passed in with the specified timer number and frequency