A class to control a model R/C servo, using a PwmOut

Dependents:   robocon2017mbed_nedoSlave

Fork of Servo by Simon Ford

Files at this revision

API Documentation at this revision

Comitter:
kikoaac
Date:
Fri Nov 10 15:15:16 2017 +0000
Parent:
3:36b69a7ced07
Commit message:
??

Changed in this revision

Servo.cpp Show annotated file Show diff for this revision Revisions of this file
Servo.h Show annotated file Show diff for this revision Revisions of this file
diff -r 36b69a7ced07 -r 684c1cd341f0 Servo.cpp
--- a/Servo.cpp	Thu Sep 02 17:34:43 2010 +0000
+++ b/Servo.cpp	Fri Nov 10 15:15:16 2017 +0000
@@ -36,6 +36,7 @@
 
 Servo::Servo(PinName pin) : _pwm(pin) {
     calibrate();
+    _pwm=0;
     write(0.5);
 }
 
diff -r 36b69a7ced07 -r 684c1cd341f0 Servo.h
--- a/Servo.h	Thu Sep 02 17:34:43 2010 +0000
+++ b/Servo.h	Fri Nov 10 15:15:16 2017 +0000
@@ -81,13 +81,13 @@
      * @param range Pulsewidth range from center (1.5ms) to maximum/minimum position in seconds
      * @param degrees Angle from centre to maximum/minimum position in degrees
      */
-    void calibrate(float range = 0.0005, float degrees = 45.0); 
+    void calibrate(float range = 0.00100, float degrees = 90.0); 
         
     /**  Shorthand for the write and read functions */
     Servo& operator= (float percent);
     Servo& operator= (Servo& rhs);
     operator float();
-
+    void shatdown(){_pwm = 0;}
 protected:
     PwmOut _pwm;
     float _range;