Andrew Russell / Servo

Dependents:   JS_1motor_20170707_ok Task_1_BallRidingbot_KeepingStationCatching_layingDown_1230 Task_2_BallRidingbot_MovingForwardCatching_backward_1230 testSSWMR_StationKeeping_200170830_OK ... more

Revision:
1:c1b2ec2662fd
Parent:
0:e50cd1696bca
Child:
2:4c315bcd91b4
--- a/Servo.cpp	Fri Feb 15 04:13:20 2013 +0000
+++ b/Servo.cpp	Fri Feb 15 05:14:48 2013 +0000
@@ -32,6 +32,7 @@
  */
 void Servo::write(float to) {
     if(to < 0 || to > 1) return;
+    _pos = to;
     float dest_pw;
     if(invert == 0) {
         dest_pw = to * _slope + _min;
@@ -48,11 +49,11 @@
  *
  * Set the limits of the PWM.
  *
- * @param float period Pulse period
- * @param float max Maximum pulse width
- * @param float min Minimum pulse width
+ * @param float period Pulse period in seconds
+ * @param float max Maximum pulse width in seconds
+ * @param float min Minimum pulse width in seconds
  */
-void Servo::calibrate(float period, float max, float min) {
+void Servo::calibrate(float period, float min, float min) {
     _period = period;
     _min = min;
     _max = max;