David Buck / Mbed 2 deprecated calibrate_esc

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "Servo.h"
00003 
00004 DigitalOut myled(LED2);
00005 Servo motor (p21);
00006 
00007 int main() {
00008 
00009 int b = 0;
00010 
00011 while (b !=2 ){
00012 
00013     motor.write(0.5);
00014     wait(3);
00015     
00016     motor.write(0); //full forward
00017     wait(1);
00018     motor.write(0.5);
00019     wait(1);
00020     myled = 1;
00021     
00022     wait(2);
00023     
00024     motor.write(0.88); //full bacward     
00025     wait(5);
00026     motor.write(0.5);
00027     wait(1);
00028     myled = 0;
00029     
00030     b = 2;
00031 }
00032 
00033     while(1) {//FIN
00034         myled = 1;
00035         wait(0.2);
00036         myled = 0;
00037         wait(0.2);
00038     }
00039 }