servomotor con PWM, sin librerias servo with PWM, without libraries

Dependencies:   Servo mbed

main.cpp

Committer:
Mateo_97
Date:
2018-05-20
Revision:
0:3a1d19a1056a

File content as of revision 0:3a1d19a1056a:

 // Continuously sweep the servo through it's full range
 #include "mbed.h"
 #include "Servo.h"
 
 Servo myservo(PB_3);
 
 int main() {
     while(1) {
         myservo.write(0.5);
         wait(1);
         myservo.write(1);
         wait(1);
         myservo.write(1.5);
         wait(1);
         myservo.write(2);
         wait(1);
         /*for(int i=0; i<200; i++) {
             myservo = i/100.0;
             wait(0.01);
         }
         for(int i=200; i>100; i--) {
             myservo = i/100.0;
             wait(0.01);
         }
         for(int i=100; i>0; i--) {
             myservo = i/100.0;
             wait(0.01);
         }*/
     }
 }