Joachim Schaeffer
/
Roboter
g
Fork of Roboter by
Diff: TEST.h
- Revision:
- 0:d453d7554981
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TEST.h Wed Jan 11 09:43:00 2017 +0000 @@ -0,0 +1,54 @@ +// Drive the m3pi forward, turn left, back, turn right, at half speed for half a second + + #include "mbed.h" + #include "m3pi_ng.h" + + m3pi pi; + + int main() { + + wait(0.5); + pi.right_motor(0.5); + pi.left_motor(0.2); + wait(0.5); + pi.left_motor(0.5); + pi.right_motor(0.2); + wait(0.5); + + pi.stop(); + wait(0.5); + + int i=1, n=0; + while(n!=8) + { + pi.leds(i); + wait(0.2); + i=i*2; + n++; + } + + wait(1); + + i=1, n=0; + while(n!=8) + { + pi.leds(i); + wait(0.2); + i=i*2; + n++; + } + + pi.stop(); + wait(0.5); + + pi.right_motor(-0.5); + pi.left_motor(-0.2); + wait(0.5); + pi.left_motor(-0.5); + pi.right_motor(-0.2); + wait(0.5); + + + pi.stop(); + +}