Dependencies:   Servo mbed

Revision:
0:153d4d641769
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 01 16:48:56 2017 +0000
@@ -0,0 +1,31 @@
+// Hello World to sweep a servo through its full range
+ 
+#include "mbed.h"
+#include "Servo.h"
+ 
+Servo myservo(p22);
+ 
+int main() {    
+    int s = 0;
+    while (1)
+    {
+        if (s = 0)
+        {
+            for(float p=0; p<1.0; p += 0.1)
+            {
+                myservo = p;
+                wait(0.4);
+            }
+            s = 1;
+        }
+        else if (s = 1)
+        {
+            for(float p=1; p>0.0; p -= 0.1)
+            {
+                myservo = p;
+                wait(0.4);
+            }
+            s = 0;
+        }
+    }
+}
\ No newline at end of file