Jurica Resetar
/
acd52832_servo
acd52832_servo example
Diff: main.cpp
- Revision:
- 0:a855473fe62b
diff -r 000000000000 -r a855473fe62b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 20 11:36:12 2016 +0000 @@ -0,0 +1,18 @@ +// Continuously sweep the servo through it's full range +#include "mbed.h" +#include "Servo.h" + +Servo myservo(p26); + +int main() { + while(1) { + for(int i=0; i<100; i+=2) { + myservo = i/100.0; + wait(0.05); + } + for(int i=100; i>0; i-=2) { + myservo = i/100.0; + wait(0.05); + } + } +}