Joseph Roberts / Mbed 2 deprecated ESC_Calibrate

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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