Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Servo by
Revision 4:82fbb7587b01, committed 2016-02-11
- Comitter:
- janhavi
- Date:
- Thu Feb 11 12:38:54 2016 +0000
- Parent:
- 3:36b69a7ced07
- Commit message:
- Servo motor Library for Eduvance-Remolab
Changed in this revision
| Servo.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Servo.cpp Thu Sep 02 17:34:43 2010 +0000
+++ b/Servo.cpp Thu Feb 11 12:38:54 2016 +0000
@@ -40,14 +40,14 @@
}
void Servo::write(float percent) {
- float offset = _range * 2.0 * (percent - 0.5);
- _pwm.pulsewidth(0.0015 + clamp(offset, -_range, _range));
+ float offset = _range * 4.0 * (percent - 0.5);
+ _pwm.pulsewidth(0.00225 + clamp(offset, -_range, _range));
_p = clamp(percent, 0.0, 1.0);
}
void Servo::position(float degrees) {
float offset = _range * (degrees / _degrees);
- _pwm.pulsewidth(0.0015 + clamp(offset, -_range, _range));
+ _pwm.pulsewidth(0.00225 + clamp(offset, -_range, _range));
}
void Servo::calibrate(float range, float degrees) {
