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.
Fork of Motor by
Revision 2:88f2d02183a4, committed 2014-10-24
- Comitter:
- masco
- Date:
- Fri Oct 24 11:56:21 2014 +0000
- Parent:
- 1:c75b234558af
- Commit message:
- Motor
Changed in this revision
Motor.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r c75b234558af -r 88f2d02183a4 Motor.cpp --- a/Motor.cpp Tue Sep 07 11:21:42 2010 +0000 +++ b/Motor.cpp Fri Oct 24 11:56:21 2014 +0000 @@ -26,7 +26,7 @@ _pwm(pwm), _fwd(fwd), _rev(rev) { // Set initial condition of PWM - _pwm.period(0.001); + _pwm.period(0); _pwm = 0; // Initial condition of output enables