Shows a lab where we can servo motor move from left to right and right to left

Dependencies:   Servo mbed

main.cpp

Committer:
EduRemo
Date:
2016-02-05
Revision:
0:3d38b95d74a0

File content as of revision 0:3d38b95d74a0:

// Hello World to sweep a servo through its full range

#include "mbed.h"
#include "Servo.h"

Servo myservo(PTC1);


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