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 ESC by
esc.cpp
00001 #include "mbed.h" 00002 #include "esc.h" 00003 00004 ESC::ESC(PwmOut pwmPinOut, int period, int throttle) 00005 : esc(pwmPinOut), period(period), throttle(throttle) { 00006 esc.period_ms(period); 00007 esc.pulsewidth_us(throttle); 00008 } 00009 00010 bool ESC::setThrottle(int t) { 00011 if (t >= 0 && t <= 100) { // qualify range, 0-100 00012 throttle = t*10 + 1000; // map to range, 1-2 ms (1000-2000us) 00013 esc.pulsewidth_us(throttle); 00014 return true; 00015 } 00016 return false; 00017 } 00018 00019 void ESC::pulse(void) { 00020 esc.pulsewidth_us(throttle); 00021 } 00022 00023 void ESC::failsafe(void) { 00024 esc.pulsewidth_us(0); 00025 }
Generated on Fri Jul 15 2022 04:22:40 by
