Collinz is a bo$$_17
/
projectcode
10/15/14 code
Diff: main.cpp
- Revision:
- 0:fbe913f85d70
diff -r 000000000000 -r fbe913f85d70 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 15 19:19:40 2014 +0000 @@ -0,0 +1,37 @@ +#include "mbed.h" +#include "Servo.h" + +Servo myservo1(p21); +Servo myservo2(p22); + + +DigitalIn sw1(p16); +DigitalIn sw2(p17); +DigitalIn sw3(p18); +DigitalIn sw4(p19); + +int switch1=sw1; +int switch2=sw2; +int switch3=sw3; +int switch4=sw4; + +int main() { + + float servopos; + + while (switch1==1) + { + while (servopos <=.6) + { + myservo1= servopos; + servopos=servopos +.005; + wait(.01); + } + while (servopos >=.3) + { + myservo1=servopos; + servopos=servopos-.005; + wait(.01); + } + } + }