software to control a DC motor, preferably interfacing with a motor driver.
DCMotor Class Reference
DC motor control class with PWM control. More...
#include <DCMotor.h>
Public Member Functions | |
DCMotor (PinName PWMPin, PinName PinA, PinName PinB) | |
create a DCMotor object connected to the pins with speed control | |
void | driveIt (float) |
drive Motor input range (-100 to 100). |
Detailed Description
DC motor control class with PWM control.
Example:
#include "mbed.h" #include "DCMotor.h" DCMotor a(p21,p22,p23); DCMotor b(p24,p25,p26); int main() { a.driveIt(50); b.driveIt(50); }
Definition at line 24 of file DCMotor.h.
Constructor & Destructor Documentation
DCMotor | ( | PinName | PWMPin, |
PinName | PinA, | ||
PinName | PinB | ||
) |
create a DCMotor object connected to the pins with speed control
- Parameters:
-
PWMPin PWM pin to control speed of motor PinA Digital output pin to connect to motor PinB Digital output pin to connect to motor
Definition at line 4 of file DCMotor.cpp.
Member Function Documentation
void driveIt | ( | float | perCent ) |
drive Motor input range (-100 to 100).
- Parameters:
-
perCent PWM pin to control speed of motor
Definition at line 14 of file DCMotor.cpp.
Generated on Tue Jul 12 2022 13:19:22 by 1.7.2