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:
10:f0df63e99a96
Parent:
9:6bfea9af4dcb
Child:
12:92dc63d24bf8
Child:
13:896410a1b594
--- a/Servo.cpp	Sun Oct 21 00:03:06 2012 +0000
+++ b/Servo.cpp	Sun Oct 21 01:29:15 2012 +0000
@@ -40,10 +40,10 @@
 bool Servo::calibrate(unsigned int plus60, unsigned int minus60, float upperLimit, float lowerLimit)
 {
     // Check if given parameters are valid
-    if (plus60 > minus60 && upperLimit > lowerLimit)
+    if (upperLimit > lowerLimit)
     {
         center = (plus60 + minus60) / 2;
-        usPerDegree = (plus60 - center) / 60.f;
+        usPerDegree = ((int)plus60 - (int)center) / 60.0f;
         this->upperLimit = upperLimit;
         this->lowerLimit = lowerLimit;   
         return true;