Public Member Functions | |
def | __init__ (self, nSLEEP_pin=pyb.Pin.board.PA15, nFAULT_pin=pyb.Pin.board.PB2, INx_pin=pyb.Pin.board.PB5, OUTx_pin=pyb.Pin.board.PB4, INy_pin=pyb.Pin.board.PB1, OUTy_pin=pyb.Pin.board.PB0, INxy_timer=pyb.Timer(3), frequency=80000) |
! More... | |
def | enable (self) |
Enables the motors. More... | |
def | disable (self) |
Disables the motors. More... | |
def | fault_CB (self) |
A callback which disables the motors on fault detection. More... | |
def | clear_fault (self) |
Clears the fault so the motors can be used. More... | |
def | set_level_1 (self, direction, level) |
Spins motor 1 in direction at level of its max power. More... | |
def | set_level_2 (self, direction, level) |
Spins motor 2 in direction at level of its max power. More... | |
Public Attributes | |
enabled | |
nsleep | |
nfault | |
m1p | |
m2p | |
m1m | |
m2m | |
tim | |
freq | |
ch1 | |
ch2 | |
ch3 | |
ch4 | |
def motor.MotorDriver.__init__ | ( | self, | |
nSLEEP_pin = pyb.Pin.board.PA15 , |
|||
nFAULT_pin = pyb.Pin.board.PB2 , |
|||
INx_pin = pyb.Pin.board.PB5 , |
|||
OUTx_pin = pyb.Pin.board.PB4 , |
|||
INy_pin = pyb.Pin.board.PB1 , |
|||
OUTy_pin = pyb.Pin.board.PB0 , |
|||
INxy_timer = pyb.Timer(3) , |
|||
frequency = 80000 |
|||
) |
!
Initializes the pins for the motors, as well as the timer.
[in] | nSLEEP_pin | pyb.Pin, Pin for not sleep The default is pyb.Pin.board.PA15. |
[in] | nFAULT_pin | pyb.Pin, Pin for not fault The default is pyb.Pin.board.PB2. |
[in] | INx_pin | pyb.Pin, pin connected to positive on motor x The default is pyb.Pin.board.PB5. |
[in] | OUTx_pin | pyb.Pin, pin connected to negative on motor x The default is pyb.Pin.board.PB4. |
[in] | INy_pin | pyb.Pin, pin connected to positive on motor y The default is pyb.Pin.board.PB1. |
[in] | OUTy_pin | pyb.Pin, pin connected to negative on motor y The default is pyb.Pin.board.PB0. |
[in] | INxy_timer | pyb.Timer(), chooses which timer to use for PWM The default is pyb.Timer(3). |
[in] | frequency | INT, defines the PWM frequency The default is 80000 |
def motor.MotorDriver.clear_fault | ( | self | ) |
Clears the fault so the motors can be used.
def motor.MotorDriver.disable | ( | self | ) |
Disables the motors.
def motor.MotorDriver.enable | ( | self | ) |
Enables the motors.
def motor.MotorDriver.fault_CB | ( | self | ) |
A callback which disables the motors on fault detection.
def motor.MotorDriver.set_level_1 | ( | self, | |
direction, | |||
level | |||
) |
Spins motor 1 in direction at level of its max power.
direction | Boolean representing direcction of motor spin |
level | Integer representing percentage level of motor power |
def motor.MotorDriver.set_level_2 | ( | self, | |
direction, | |||
level | |||
) |
Spins motor 2 in direction at level of its max power.
direction | Boolean representing direcction of motor spin |
level | Integer representing percentage level of motor power |