![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Shows a lab where we can servo motor move from left to right and right to left
Diff: main.cpp
- Revision:
- 0:3d38b95d74a0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 05 07:28:18 2016 +0000 @@ -0,0 +1,20 @@ +// Hello World to sweep a servo through its full range + +#include "mbed.h" +#include "Servo.h" + +Servo myservo(PTC1); + + +int main() { + while(1) { + for(int i=0; i<=100; i++) { + myservo = i/100.0; + wait(0.1); + } + for(int i=99; i>=0; i--) { + myservo = i/100.0; + wait(0.1); + } + } +}