acd52832_servo example

Dependencies:   Servo mbed

Committer:
jurica238814
Date:
Tue Sep 20 11:36:12 2016 +0000
Revision:
0:a855473fe62b
acd52832_servo example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jurica238814 0:a855473fe62b 1 // Continuously sweep the servo through it's full range
jurica238814 0:a855473fe62b 2 #include "mbed.h"
jurica238814 0:a855473fe62b 3 #include "Servo.h"
jurica238814 0:a855473fe62b 4
jurica238814 0:a855473fe62b 5 Servo myservo(p26);
jurica238814 0:a855473fe62b 6
jurica238814 0:a855473fe62b 7 int main() {
jurica238814 0:a855473fe62b 8 while(1) {
jurica238814 0:a855473fe62b 9 for(int i=0; i<100; i+=2) {
jurica238814 0:a855473fe62b 10 myservo = i/100.0;
jurica238814 0:a855473fe62b 11 wait(0.05);
jurica238814 0:a855473fe62b 12 }
jurica238814 0:a855473fe62b 13 for(int i=100; i>0; i-=2) {
jurica238814 0:a855473fe62b 14 myservo = i/100.0;
jurica238814 0:a855473fe62b 15 wait(0.05);
jurica238814 0:a855473fe62b 16 }
jurica238814 0:a855473fe62b 17 }
jurica238814 0:a855473fe62b 18 }