Example to sweep a servo through its range
Fork of Servo_HelloWorld by
main.cpp
- Committer:
- woyao74le
- Date:
- 2015-07-24
- Revision:
- 2:7911e5580e4e
- Parent:
- 1:40d2fd0b99e6
File content as of revision 2:7911e5580e4e:
// Hello World to sweep a servo through its full range #include "mbed.h" PwmOut PWM1(PA_1); int main() { PWM1.period(0.02); while(1) { for (float i=0.025; i<0.04; i=i+0.001) { PWM1=i; wait(0.02); } for (float i=0.04; i>0.025; i=i-0.001) { PWM1=i; wait(0.02); } } }