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.
Revision 0:974ec566f994, committed 2014-09-18
- Comitter:
- joe4465
- Date:
- Thu Sep 18 08:33:53 2014 +0000
- Commit message:
- Final version
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 974ec566f994 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 18 08:33:53 2014 +0000 @@ -0,0 +1,40 @@ +#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); + } + } + } +}
diff -r 000000000000 -r 974ec566f994 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 18 08:33:53 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877 \ No newline at end of file