A class for driving a DC motor using a full-bridge (H-bridge) driver.
Dependencies: RateLimiter
Dependents: L298N-Breakout-Test Zavrsni_rad_NXP_cup
Diff: HBridgeDCMotor.h
- Revision:
- 3:a99a538c067d
- Parent:
- 2:1675a4c00925
diff -r 1675a4c00925 -r a99a538c067d HBridgeDCMotor.h --- a/HBridgeDCMotor.h Fri Dec 11 13:08:15 2015 +0000 +++ b/HBridgeDCMotor.h Fri Dec 11 14:14:56 2015 +0000 @@ -5,6 +5,26 @@ * * The class has an option to drive all 4 transistors gates independently by using 4 PwmOut objects, * or to drive the H-bridge with complementary driven transistors using only 2 PwmOut objects. + * + * Example of use: + * + * @code + * #include "mbed.h" + * #include "HBridgeDCMotor.h" + * + * HBridgeDCMotor motor(p21, p22); + * + * int main() { + * float sampleTime = 50e-3, switchingFrequency = 25e3, rampTime = 3; + * motor.configure(sampleTime, switchingFrequency, rampTime, rampTime); + * while(true) { + * motor.setDutyCycle(1); + * wait(10); + * motor.setDutyCycle(-1); + * wait(10); + * } + * } + * @endcode */ class HBridgeDCMotor { public: