Control a DC motor via a standard H-bridge using a PwmOut pin to control speed and two DigitalOut pins to control direction. Can change pwm period on the PwmOut pin, and also brake high or low.
Dependents: SimpleRover PIDRover IMURover incrementalencoder-pid-robot ... more
Motor Class Reference
Interface to control a standard DC motor with an H-bridge using a PwmOut and 2 DigitalOuts. More...
#include <Motor.h>
Public Member Functions | |
Motor (PinName pwm, PinName fwd, PinName rev) | |
Create a motor control interface. | |
void | speed (float speed) |
Set the speed of the motor. | |
void | period (float period) |
Set the period of the pwm duty cycle. | |
void | brake (int highLow=BRAKE_HIGH) |
Brake the H-bridge to GND or VCC. |
Detailed Description
Interface to control a standard DC motor with an H-bridge using a PwmOut and 2 DigitalOuts.
Definition at line 34 of file Motor.h.
Constructor & Destructor Documentation
Motor | ( | PinName | pwm, |
PinName | fwd, | ||
PinName | rev | ||
) |
Member Function Documentation
void brake | ( | int | highLow = BRAKE_HIGH ) |
void period | ( | float | period ) |
Generated on Tue Jul 12 2022 13:20:10 by 1.7.2