A class to control a model R/C servo, using a PwmOut
Dependents: Brute_TS_Controller_2018_11
Diff: Servo.h
- Revision:
- 6:917d115add54
- Parent:
- 3:36b69a7ced07
--- a/Servo.h Wed May 09 15:42:15 2018 +0000
+++ b/Servo.h Wed May 09 17:11:54 2018 +0000
@@ -62,37 +62,37 @@
*
* @param percent A normalised number 0.0-1.0 to represent the full range.
*/
- void write(float percent);
+ void write(double percent);
/** Read the servo motors current position
*
* @param returns A normalised number 0.0-1.0 representing the full range.
*/
- float read();
+ double read();
/** Set the servo position
*
* @param degrees Servo position in degrees
*/
- void position(float degrees);
+ void position(double degrees);
/** Allows calibration of the range and angles for a particular servo
*
* @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(double range = 0.0005, double degrees = 45.0);
/** Shorthand for the write and read functions */
- Servo& operator= (float percent);
+ Servo& operator= (double percent);
Servo& operator= (Servo& rhs);
- operator float();
+ operator double();
protected:
PwmOut _pwm;
- float _range;
- float _degrees;
- float _p;
+ double _range;
+ double _degrees;
+ double _p;
};
#endif