acd52832_servo example

Dependencies:   Servo mbed

main.cpp

Committer:
jurica238814
Date:
2016-09-20
Revision:
0:a855473fe62b

File content as of revision 0:a855473fe62b:

// Continuously sweep the servo through it's full range
#include "mbed.h"
#include "Servo.h"

Servo myservo(p26);

int main() {
    while(1) {
        for(int i=0; i<100; i+=2) {
            myservo = i/100.0;
            wait(0.05);
        }
        for(int i=100; i>0; i-=2) {
            myservo = i/100.0;
            wait(0.05);
        }
    }
}