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.
Fork of Motordriver by
Revision 6:415f0e127063, committed 2018-07-13
- Comitter:
- apriljunio
- Date:
- Fri Jul 13 19:57:27 2018 +0000
- Parent:
- 5:3110b9209d3c
- Commit message:
- Changed PWM period to be 20kHz;
Changed in this revision
motordriver.cpp | Show annotated file Show diff for this revision Revisions of this file |
motordriver.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3110b9209d3c -r 415f0e127063 motordriver.cpp --- a/motordriver.cpp Thu Nov 25 13:34:15 2010 +0000 +++ b/motordriver.cpp Fri Jul 13 19:57:27 2018 +0000 @@ -32,9 +32,8 @@ Motor::Motor(PinName pwm, PinName fwd, PinName rev, int brakeable): _pwm(pwm), _fwd(fwd), _rev(rev) { - // Set initial condition of PWM - _pwm.period(0.001); + _pwm.period(0.00005); // PWM set to 20 kHz _pwm = 0; // Initial condition of output enables @@ -115,7 +114,7 @@ } else if ((_fwd == 0) && (_rev == 1)) { return -(_pwm);//reversing } else if ((_fwd == 1) && (_rev == 0)) { - return _pwm;//fowards + return _pwm;//foRwards } else return -3;//error }
diff -r 3110b9209d3c -r 415f0e127063 motordriver.h --- a/motordriver.h Thu Nov 25 13:34:15 2010 +0000 +++ b/motordriver.h Fri Jul 13 19:57:27 2018 +0000 @@ -79,13 +79,11 @@ PwmOut _pwm; DigitalOut _fwd; DigitalOut _rev; - int Brakeable; // cna the motor driver break + int Brakeable; // can the motor driver break int sign; //prevents throwing the motor from full foward to full reverse and stuff melting. }; - - #endif