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.

Dependencies:   Servo mbed

Committer:
domhardyct
Date:
Tue Nov 11 18:21:12 2014 +0000
Revision:
0:7097ca5bf81d
Program from Domenico Ardito Catania ITALY. Revision 1 sweeping delay time and turning angle for servo connected to pin D9.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
domhardyct 0:7097ca5bf81d 1 //Created by Domenico Ardito - I.T. Archimede - Catania ITALY
domhardyct 0:7097ca5bf81d 2 #include<mbed.h>
domhardyct 0:7097ca5bf81d 3 #include<Servo.h>
domhardyct 0:7097ca5bf81d 4 DigitalOut myled(LED3);
domhardyct 0:7097ca5bf81d 5 Servo myservo(D9); //pin D9 of Arduino
domhardyct 0:7097ca5bf81d 6 int main()
domhardyct 0:7097ca5bf81d 7 {for(float ritardo=0.1;ritardo<1.0;ritardo+=0.05)
domhardyct 0:7097ca5bf81d 8 {
domhardyct 0:7097ca5bf81d 9 for(float p=0.0;p<2.0;p+=0.5)
domhardyct 0:7097ca5bf81d 10 {myservo=p;
domhardyct 0:7097ca5bf81d 11 myled=1;
domhardyct 0:7097ca5bf81d 12 wait(ritardo);
domhardyct 0:7097ca5bf81d 13 myled=0;
domhardyct 0:7097ca5bf81d 14 wait(ritardo);
domhardyct 0:7097ca5bf81d 15 }
domhardyct 0:7097ca5bf81d 16
domhardyct 0:7097ca5bf81d 17 }
domhardyct 0:7097ca5bf81d 18 }