Example program to sweep delay time and turning angle for a standard servo connected to pin D9, with flashing LED D3 according to servo delay time.
Diff: main.cpp
- Revision:
- 0:7097ca5bf81d
diff -r 000000000000 -r 7097ca5bf81d main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 11 18:21:12 2014 +0000 @@ -0,0 +1,18 @@ +//Created by Domenico Ardito - I.T. Archimede - Catania ITALY +#include<mbed.h> +#include<Servo.h> +DigitalOut myled(LED3); +Servo myservo(D9); //pin D9 of Arduino +int main() +{for(float ritardo=0.1;ritardo<1.0;ritardo+=0.05) +{ +for(float p=0.0;p<2.0;p+=0.5) +{myservo=p; +myled=1; +wait(ritardo); +myled=0; +wait(ritardo); +} + +} +} \ No newline at end of file