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.
Dependents: MTQuadControl Base_Hybrid_V2 base_rekam_darurat_v1 Base_Hybrid_Latihan_Ok_Hajar_servo_pwm ... more
You are viewing an older revision! See the latest version
Homepage
Simple usage example¶
Simple ESC usage example
#include "mbed.h"
#include "esc.h" //include the ESC class
int main()
{
ESC esc1(p26); //declare the ESC as connected to pin p26.
float throttle_var = 0.5 //that means 50%.
while(1)
{
//... update throttle_var ...
esc1 = throttle_var; //memorize the throttle value (it doesn't send it to the ESC).
//... do whatever you want - e.g. call esc1.setThrottle(throttle_var) again ...
esc1(); //actually sets the throttle to the ESC.
wait_ms(20); //20ms is the default period of the ESC pwm; the ESC may not run faster.
}
}