![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
here's a basic way to get the servos running back and not really forth. Next to come, integration of the servo.
Diff: main.cpp
- Revision:
- 0:f8b0e15576fe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 16 18:45:41 2014 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "Servo.h" + + + +Servo myservo1(p21); //top +Servo myservo2(p22); //bottom + +int main() +{ + while(1) { + + float servopos; + //servopos=0.38; + + + + while(servopos=servopos+0.03; servopos<=.67) { + servopos=servopos+0.03; + myservo1=servopos+.28; + myservo2=servopos; + printf("Servo 1 position %.2f Servo 2 position %.2f\n\r", servopos, (servopos)); + } + while(servopos>=.39) { + servopos=servopos-.03; + myservo1=servopos+.24; + myservo2=servopos; + printf("Servo 1 position %.2f Servo 2 position %.2f\n\r", servopos, (servopos)); + } + + } +}