130901現在開発中 BD6211 motor driver Library FIN,RIN にPWM信号を入れて速度制御する
Fork of Motordriver by
Motor Class Reference
Interface to control a standard DC motor with an H-bridge using a PwmOut and 2 DigitalOuts. More...
#include <BD6211_motordriver.h>
Public Member Functions | |
Motor (PinName fwd, PinName rev, int breakeable) | |
Create a motor control interface. | |
float | speed (float speed) |
Set the speed of the motor. | |
void | coast (void) |
Set the the motor to coast. | |
float | stop (float duty) |
Set the motor to dynamicaly brake. | |
float | state (void) |
return the current state of the motor |
Detailed Description
Interface to control a standard DC motor with an H-bridge using a PwmOut and 2 DigitalOuts.
Definition at line 37 of file BD6211_motordriver.h.
Constructor & Destructor Documentation
Motor | ( | PinName | fwd, |
PinName | rev, | ||
int | breakeable | ||
) |
Create a motor control interface.
- Parameters:
-
pwm A PwmOut pin, driving the H-bridge enable line to control the speed fwd A DigitalOut, set high when the motor should go forward rev A DigitalOut, set high when the motor should go backwards set if the motor driver is able to do braking 0 false 1 true.
Definition at line 35 of file BD6211_motordriver.cpp.
Member Function Documentation
void coast | ( | void | ) |
Set the the motor to coast.
- Parameters:
-
void
- Returns:
- motor coasts until another instruction is recived.
Definition at line 138 of file BD6211_motordriver.cpp.
float speed | ( | float | speed ) |
Set the speed of the motor.
- Parameters:
-
speed The speed of the motor as a normalised value between -1.0 and 1.0.
- Returns:
- the applied speed to the motor after checking to ensure motor doesn't switch from forward to reverse without stopping.
Definition at line 57 of file BD6211_motordriver.cpp.
float state | ( | void | ) |
return the current state of the motor
- Parameters:
-
void
- Returns:
- state of motor, -1 to 1 is speed, -2 is braking, 2 is coasting. -3 is error.
Definition at line 166 of file BD6211_motordriver.cpp.
float stop | ( | float | duty ) |
Set the motor to dynamicaly brake.
- Parameters:
-
float 0 - 1.0 provides some control over how hard the motor brakes.
- Returns:
- duty applied to motor driver. -1 is error, motor driver can't brake.
Definition at line 149 of file BD6211_motordriver.cpp.
Generated on Fri Jul 22 2022 03:58:08 by 1.7.2