LED.h & Umwandeln.h

Dependencies:   m3pi_ng mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TEST.h Source File

TEST.h

00001 // Drive the m3pi forward, turn left, back, turn right, at half speed for half a second
00002 
00003   #include "mbed.h"
00004   #include "m3pi_ng.h"
00005 
00006   m3pi pi;
00007 
00008   int main() {
00009 
00010     wait(0.5);
00011     pi.right_motor(0.5);
00012     pi.left_motor(0.2);
00013     wait(0.5);
00014     pi.left_motor(0.5);
00015     pi.right_motor(0.2);
00016     wait(0.5);
00017   
00018     pi.stop();
00019     wait(0.5);
00020       
00021     int i=1, n=0;
00022     while(n!=8)
00023     {
00024         pi.leds(i);
00025         wait(0.2);
00026         i=i*2;
00027         n++;
00028     }
00029     
00030     wait(1);
00031 
00032     i=1, n=0;
00033     while(n!=8)
00034     {
00035         pi.leds(i);
00036         wait(0.2);
00037         i=i*2;
00038         n++;
00039     }
00040 
00041     pi.stop();
00042     wait(0.5);
00043     
00044     pi.right_motor(-0.5);
00045     pi.left_motor(-0.2);
00046     wait(0.5);
00047     pi.left_motor(-0.5);
00048     pi.right_motor(-0.2);
00049     wait(0.5);
00050     
00051     
00052     pi.stop();
00053 
00054 }