Wrapper library for ESC PWM throttle control.
Fork of ESC by
Revision 2:b2d19bc95805, committed 2017-05-05
- Comitter:
- IonSystems
- Date:
- Fri May 05 14:10:46 2017 +0000
- Parent:
- 1:4c02fede684b
- Commit message:
- Cameron has entered the game.
Changed in this revision
esc.cpp | Show annotated file Show diff for this revision Revisions of this file |
esc.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4c02fede684b -r b2d19bc95805 esc.cpp --- a/esc.cpp Sun Jun 09 22:23:45 2013 +0000 +++ b/esc.cpp Fri May 05 14:10:46 2017 +0000 @@ -1,8 +1,8 @@ #include "mbed.h" #include "esc.h" -ESC::ESC(PwmOut pwmPinOut, int period) - : esc(pwmPinOut), period(period), throttle(1000) { +ESC::ESC(PwmOut pwmPinOut, int period, int throttle) + : esc(pwmPinOut), period(period), throttle(throttle) { esc.period_ms(period); esc.pulsewidth_us(throttle); } @@ -19,3 +19,7 @@ void ESC::pulse(void) { esc.pulsewidth_us(throttle); } + +void ESC::failsafe(void) { + esc.pulsewidth_us(0); +}
diff -r 4c02fede684b -r b2d19bc95805 esc.h --- a/esc.h Sun Jun 09 22:23:45 2013 +0000 +++ b/esc.h Fri May 05 14:10:46 2017 +0000 @@ -58,9 +58,10 @@ class ESC { public: - ESC(PwmOut,int=20); // Constructor(pwmPinOut,period_ms) + ESC(PwmOut,int=20,int=1000); // Constructor(pwmPinOut,period_ms) bool setThrottle(int); // range 0-100 void pulse(void); + void failsafe(void); private: PwmOut esc; // pinout from MCU