Simple program used to calibrate AFRO ESC's from HobbyKing
Used to calibrate 4 ESC's at once. Connect each ESC's PWM input pin to p22, p23, p24, p25 respectively. This will calibrate the ESC's with a maximum PWM pulse width of 1860 and a minimum of 1060. These numbers can be changed to match your setup.
main.cpp
- Committer:
- joe4465
- Date:
- 2014-09-18
- Revision:
- 0:974ec566f994
File content as of revision 0:974ec566f994:
#include "mbed.h"
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX); // tx, rx
PwmOut _motor1(p22);
PwmOut _motor2(p23);
PwmOut _motor3(p24);
PwmOut _motor4(p25);
int main()
{
float period = 1.0 / 500;
_motor1.period(period);
_motor2.period(period);
_motor3.period(period);
_motor4.period(period);
_motor1.pulsewidth_us(1860);
_motor2.pulsewidth_us(1860);
_motor3.pulsewidth_us(1860);
_motor4.pulsewidth_us(1860);
myled = 1;
while(1)
{
if(pc.readable())
{
if(pc.getc() == 'a')
{
myled = 0;
_motor1.pulsewidth_us(1060);
_motor2.pulsewidth_us(1060);
_motor3.pulsewidth_us(1060);
_motor4.pulsewidth_us(1060);
}
}
}
}
Joseph Roberts