Example program, usingthe Servo library

Dependencies:   Servo mbed

Fork of ServoProgram by Simon Ford

main.cpp

Committer:
manuelmbed86
Date:
2017-08-16
Revision:
1:e5135330cd7a
Parent:
0:7b3eabfa1a0f

File content as of revision 1:e5135330cd7a:

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

Servo myservo(A5);
Serial pc(USBTX, USBRX);

    float range = 0.0005;
    float position = 0.5;
int main() {
 
    while(1) {
          for(int i=0; i<100; i++) {
              myservo = i/100.0;
              wait(0.05);
          }
          for(int i=100; i>0; i--) {
             myservo = i/100.0;
              wait(0.05);
          }
      }
  }