A simple library for driving RC servos without using the mbed's PWM functions. This allows the mbed to drive as many servos as there are DigitalOut pins, and additionally allows for the PWM functions to be used at a different frequency than the 50Hz used for servos.

Revision:
15:55221f9de707
Parent:
14:0eff26aa0d17
--- a/Servo.h	Wed Jan 09 21:08:53 2013 +0000
+++ b/Servo.h	Thu Jan 17 18:32:18 2013 +0000
@@ -8,12 +8,14 @@
 class Servo
 {
 public:
-    Servo(PinName pin);
+    Servo(PinName pin, bool start = true);
     bool calibrate(unsigned int plus45, unsigned int minus45, float upperLimit, float lowerLimit);
     void write(float degrees);
     void writeWidth(unsigned int width);
     float read();
     int readWidth();
+    void disable();
+    void enable();
     void operator=(float degrees);
     operator float();
     operator int();
@@ -31,6 +33,7 @@
     Timeout servoTimeout;
     unsigned int pulseWidth;
     DigitalOut signalPin;
+    bool enabled;