Coreonetech / Mbed 2 deprecated CORE-1000_servoMotor

Dependencies:   Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
odb
Date:
Fri Feb 03 08:04:53 2017 +0000
Parent:
1:40d2fd0b99e6
Commit message:
CORE-1000 First

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
--- a/main.cpp	Tue Nov 23 16:10:35 2010 +0000
+++ b/main.cpp	Fri Feb 03 08:04:53 2017 +0000
@@ -1,9 +1,40 @@
+#include "mbed.h"
+#include "Servo.h"
+
+Servo myservo(PB_13);
+Serial pc(USBTX, USBRX);
+
+int main() {
+    printf("Servo Calibration Controls:\r\n");
+    printf("1,2,3 - Position Servo (full left, middle, full right)\r\n");
+    printf("4,5 - Decrease or Increase range\r\n");
+
+    float range = 0.0005;
+    float position = 0.5;
+    
+    while(1) {                   
+        switch(pc.getc()) {
+            case '1': position = 0.0; break;
+            case '2': position = 0.5; break;
+            case '3': position = 1.0; break;
+            case '4': range += 0.0001; break; 
+            case '5': range -= 0.0001; break; 
+        }
+        printf("position = %.1f, range = +/-%0.4f\r\n", position, range);
+        myservo.calibrate(range, 45.0); 
+        myservo = position;
+    }
+}
+
+
+/* test
+
 // Hello World to sweep a servo through its full range
 
 #include "mbed.h"
 #include "Servo.h"
 
-Servo myservo(p21);
+Servo myservo(PA_15);
 
 int main() {    
     for(float p=0; p<1.0; p += 0.1) {
@@ -11,3 +42,4 @@
         wait(0.2);
     }
 }
+*/
\ No newline at end of file
--- a/mbed.bld	Tue Nov 23 16:10:35 2010 +0000
+++ b/mbed.bld	Fri Feb 03 08:04:53 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file