Hello world program that just gets the m3pi moving
Fork of m3pi_HelloWorld by
main.cpp
- Committer:
- jograesser
- Date:
- 2018-03-06
- Revision:
- 8:c9f5f6464497
- Parent:
- 7:d0689e8f23bf
File content as of revision 8:c9f5f6464497:
#include "mbed.h" #include "m3pi_ng.h" #include <string> m3pi m3pi; Serial Ser(USBTX, USBRX); // tx, rx char ser_data[20]; DigitalIn button(p21); int raw_data[5]; BusOut led(p19); BusOut led2(p20,p19,p18,p17,p16,p15,p14,p13); int main() { m3pi.reset(); led2 = 0; m3pi.locate(0,1); float bat_vol = m3pi.battery(); m3pi.printf("%d",bat_vol); char doh[] ="V1504E4C8D8E8C8D8E8F4D8E8F8D8E8F8GG8E8D8C4"; m3pi.playtune(doh,40); for( int i=0; i<5;i++){ m3pi.raw_sensor(raw_data); for(int u=0;u<5;u++){ Ser.printf("%d",raw_data[u]); Ser.printf("\r\n"); } wait(1); Ser.printf("\n"); } /* //blinkenlights while(button){ led= 255; wait(1); led =0 ; wait(1); } */ /* Ser.scanf(ser_data); m3pi.printf(ser_data); while(button){ m3pi.printf("P21"); wait(1); m3pi.cls(); } */ /* m3pi.forward(0.25); // Forward half speed wait (1); // wait half a second m3pi.left(0.25); // Turn left at half speed wait (1); // wait half a second m3pi.backward(0.25);// Backward at half speed wait (1); // wait half a second m3pi.right(0.25); // Turn right at half speed wait (1); // wait half a second */ m3pi.stop(); }