A program using forked servo.h that allows controlling the speed of multiple individual servos. Each servo runs at a different speed if required. ANY output port can be used. (PWM not required)
Dependencies: VarSpeedServo mbed
Revision 2:95cabad9292b, committed 2015-10-14
- Comitter:
- sierrasmith71
- Date:
- Wed Oct 14 02:11:24 2015 +0000
- Parent:
- 1:1a696cb039ef
- Commit message:
- fixed initialization of NewPostion in Enable main.cpp
Changed in this revision
Servo.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1a696cb039ef -r 95cabad9292b Servo.lib --- a/Servo.lib Mon Oct 12 15:01:58 2015 +0000 +++ b/Servo.lib Wed Oct 14 02:11:24 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/sierrasmith71/code/VarSpeedServo/#774dd54867f2 +https://developer.mbed.org/users/sierrasmith71/code/VarSpeedServo/#8bdb46e629b9
diff -r 1a696cb039ef -r 95cabad9292b main.cpp --- a/main.cpp Mon Oct 12 15:01:58 2015 +0000 +++ b/main.cpp Wed Oct 14 02:11:24 2015 +0000 @@ -37,16 +37,17 @@ Servo Servo2(D10); Servo1.Enable(1500,50,10); // Start position ; in us (1500 = center), servo refresh rate in Hz (analog servos = 50 Hz), servo movement speed range from 1-50, 1 slowest, about 20 seconds/180 degrees Servo2.Enable(1500,50,10); + + wait(5.0); while(1) { - Servo1.SetPosition(2300); - Servo2.SetPosition(2300); - wait(2.5); - - Servo1.SetPosition(700); Servo2.SetPosition(700); wait(2.5); + + Servo1.SetPosition(2300); + Servo2.SetPosition(2300); + wait(2.5); } }