Made changes to individually control servo speeds

Dependents:   VariableSpeedServo

Fork of Servo by Jasper Denkers

Revision:
2:466f005a4dd5
Parent:
1:352133517ccc
Child:
3:774dd54867f2
--- a/Servo.h	Sun Oct 17 13:34:19 2010 +0000
+++ b/Servo.h	Sun Oct 11 20:50:48 2015 +0000
@@ -65,25 +65,39 @@
      */
     void SetPosition(int NewPos);
     
+    /** speed oonversion from arbitary range of 1-50 to us to set Speed Ticker rate.
+    * @param int 1-50
+    */
+    int SpeedConvert (int _speed);  
+    
     /** Enable the servo. Without enabling the servo won't be running. Startposition and period both in us.
      *
      * @param StartPos The position of the servo to start (us) 
-     * @param Period The time between every pulse. 20000 us = 50 Hz(standard) (us)
+     * @param RefreshRate.set in Hz  The time between every servo pulse. 20000 us = 50 Hz(standard) (us) 
+                Analog servos typically use a 50Hz refresh rate, while digital servos can use up to a 300Hz refresh rate. 
+     * @parm _speed The time between updating the pulse width of the servo pulses --controls speed of servo movement
      */
-    void Enable(int StartPos, int Period);
+    void Enable(int StartPos, int RefreshRate, int _speed);
     
     /** Disable the servo. After disabling the servo won't get any signal anymore
      *
      */
+     void Update();
+     int speed;
+     int CurrentPosition;
     void Disable();
 
 private:
     void StartPulse();
     void EndPulse();
-
     int Position;
+    int Period; 
+    int NewPosition;
+    //int speed; 
+    //int CurrentPosition;    
     DigitalOut ServoPin;
     Ticker Pulse;
+    Ticker Speed;
     Timeout PulseStop;
 };