Wrapper library for ESC PWM throttle control.
Fork of ESC by
Diff: esc.cpp
- Revision:
- 1:4c02fede684b
- Parent:
- 0:ec466ef657a2
- Child:
- 2:b2d19bc95805
--- a/esc.cpp Thu Jun 06 18:57:02 2013 +0000 +++ b/esc.cpp Sun Jun 09 22:23:45 2013 +0000 @@ -1,11 +1,3 @@ -/** - * esc.cpp - * UWB Quadcopter Project - * - * - * @Author - * Mitch Carlson - */ #include "mbed.h" #include "esc.h" @@ -16,8 +8,9 @@ } bool ESC::setThrottle(int t) { - if (t >= 0 && t <= 100) { // qualify range - throttle = t*10 + 1000; // map range, 1-2 ms (1000-2000us) + if (t >= 0 && t <= 100) { // qualify range, 0-100 + throttle = t*10 + 1000; // map to range, 1-2 ms (1000-2000us) + esc.pulsewidth_us(throttle); return true; } return false;