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 Class Reference
#include <esc.h>
Detailed Description
ESC Class Example:
#include "mbed.h" #include "esc.h" ESC esc1(PTD4); ESC esc2(PTA12); ESC esc3(PTA4); ESC esc4(PTA5); Serial pc(USBTX, USBRX); // tx, rx int main() { char c; int var = 0; while(1) { c = pc.getc(); if (c == 'u') { if (var < 100) { var++; } if (esc1.setThrottle(var) && esc2.setThrottle(var) && esc3.setThrottle(var) && esc4.setThrottle(var)) { printf("%i\r\n", var); } } else if (c == 'd') { if (var > 0) { var--; } if (esc1.setThrottle(var) && esc2.setThrottle(var) && esc3.setThrottle(var) && esc4.setThrottle(var)) { printf("%i\r\n", var); } } else if (c == 'r') { var = 0; if (esc1.setThrottle(var) && esc2.setThrottle(var) && esc3.setThrottle(var) && esc4.setThrottle(var)) { printf("%i\r\n", var); } } esc1.pulse(); esc2.pulse(); esc3.pulse(); esc4.pulse(); wait_ms(20); // 20ms is the default period of the ESC pwm } }
Generated on Fri Jul 15 2022 04:22:40 by
