Servo_Demo

Dependencies:   mbed Servo

main.cpp

Committer:
luigi_lagatta
Date:
2019-04-17
Revision:
1:21aeba9a6128
Parent:
0:3d38b95d74a0

File content as of revision 1:21aeba9a6128:

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

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

Servo myservo(D3);


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);
          }
      }
}