A simple test program to test the Servo library.

Dependencies:   mbed Servo

Files at this revision

API Documentation at this revision

Comitter:
jdenkers
Date:
Sun Oct 17 13:52:21 2010 +0000
Commit message:

Changed in this revision

Servo.lib Show annotated file Show diff for this revision Revisions of this file
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 0d481c229e21 Servo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Sun Oct 17 13:52:21 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/jdenkers/code/Servo/#352133517ccc
diff -r 000000000000 -r 0d481c229e21 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Oct 17 13:52:21 2010 +0000
@@ -0,0 +1,19 @@
+// Keep sweeping servo from left to right
+#include "mbed.h"
+#include "Servo.h"
+
+Servo Servo1(p20);
+
+int main() {
+    Servo1.Enable(1000,20000);
+    while(1) {
+        for (int pos = 1000; pos < 2000; pos += 25) {
+            Servo1.SetPosition(pos);
+            wait_ms(20);
+        }
+        for (int pos = 2000; pos > 1000; pos -= 25) {
+            Servo1.SetPosition(pos); 
+            wait_ms(20);
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 0d481c229e21 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Oct 17 13:52:21 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e