Gets user Input to turn the servo to certain degrees
Diff: servo.cpp
- Revision:
- 2:9d9717796ab2
- Child:
- 3:5b6a55afc60a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servo.cpp Sun Jan 13 21:57:11 2019 +0000 @@ -0,0 +1,26 @@ +#include "servo.h" +PwmOut servo(p21); + +void setServo(); + servo.period(0.020); + servo.pulsewidth_us(1500); + wait(2); + } + +void moveServo(char a){ + switch(a){ + case 1: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 2: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 3: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 4: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 4: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 5: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 6: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 7: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 8: servo.pulsdewidth_us(pulsewidth(-90)); break; + case 9: servo.pulsdewidth_us(pulsewidth(-90)); break; + } + + + + } \ No newline at end of file