Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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