Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
SED9008
Date:
Mon Mar 19 15:46:08 2012 +0000
Commit message:

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	Mon Mar 19 15:46:08 2012 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+AnalogIn control(p18);
+PwmOut servo(p21);
+
+int main() {
+    servo.period(0.020);          // servo requires a 20ms period
+    float input = control.read();
+    
+    while (1) {
+        input = control.read()/1000;
+        servo.pulsewidth(0.001 + input); // servo position determined by a pulsewidth between 1-2ms
+        wait(0.25);
+       
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 19 15:46:08 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479