ITI "DallaChiesa" 2019
/
Servo_motor_Demo
Servo_Demo
Diff: main.cpp
- Revision:
- 0:3d38b95d74a0
- Child:
- 1:21aeba9a6128
--- /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); + } + } +}