how to control a servo

Dependencies:   Servo mbed

Fork of Servo_HelloWorld by Simon Ford

main.cpp

Committer:
Maggie17
Date:
2016-05-28
Revision:
5:04e18a0d9dfb
Parent:
4:0b1d0b30c936

File content as of revision 5:04e18a0d9dfb:

#include "mbed.h"   // this tells us to load mbed related functions
#include "Servo.h"  // library for the Servo

Servo myservo(p10);

// this code runs when the microcontroller starts up
int main() {    
    for(float p=0; p<1.0; p += 0.1) {
        myservo = p;
        
        wait(0.2);
        // YOUR CODE HERE : make code run between 0-1 only!
    }
}