Simple program used to calibrate AFRO ESC's from HobbyKing

Dependencies:   mbed

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
--- /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);
+            }
+        }
+    }
+}