Control a servo with an analog value (knob). A basic example of using a servo.

Dependencies:   Servo mbed

Revision:
0:3a3bfe92df7c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 19 15:26:02 2014 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+#include "Servo.h"
+
+int main()
+{
+    Servo myservo(D3);                // Create the servo object
+    AnalogIn knob(A0);                // Create the analog input object
+    
+    float val;
+    
+    myservo.calibrate(0.00095, 90.0); // Calibrate the servo
+        
+    while(1)
+    {
+        val = knob.read();            // Reads the value of the potentiometer (value between 0 and 1) 
+        myservo.write(val);           // Sets the servo position according to the scaled value  (0-1)
+        wait_ms(15);                  // Waits for the servo to get there 
+    }
+}