Joachim Schaeffer
/
Roboter
g
Fork of Roboter by
TEST.h@0:d453d7554981, 2017-01-11 (annotated)
- Committer:
- spolak
- Date:
- Wed Jan 11 09:43:00 2017 +0000
- Revision:
- 0:d453d7554981
Klassen zum Blinken und Umwandeln vom Text
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
spolak | 0:d453d7554981 | 1 | // Drive the m3pi forward, turn left, back, turn right, at half speed for half a second |
spolak | 0:d453d7554981 | 2 | |
spolak | 0:d453d7554981 | 3 | #include "mbed.h" |
spolak | 0:d453d7554981 | 4 | #include "m3pi_ng.h" |
spolak | 0:d453d7554981 | 5 | |
spolak | 0:d453d7554981 | 6 | m3pi pi; |
spolak | 0:d453d7554981 | 7 | |
spolak | 0:d453d7554981 | 8 | int main() { |
spolak | 0:d453d7554981 | 9 | |
spolak | 0:d453d7554981 | 10 | wait(0.5); |
spolak | 0:d453d7554981 | 11 | pi.right_motor(0.5); |
spolak | 0:d453d7554981 | 12 | pi.left_motor(0.2); |
spolak | 0:d453d7554981 | 13 | wait(0.5); |
spolak | 0:d453d7554981 | 14 | pi.left_motor(0.5); |
spolak | 0:d453d7554981 | 15 | pi.right_motor(0.2); |
spolak | 0:d453d7554981 | 16 | wait(0.5); |
spolak | 0:d453d7554981 | 17 | |
spolak | 0:d453d7554981 | 18 | pi.stop(); |
spolak | 0:d453d7554981 | 19 | wait(0.5); |
spolak | 0:d453d7554981 | 20 | |
spolak | 0:d453d7554981 | 21 | int i=1, n=0; |
spolak | 0:d453d7554981 | 22 | while(n!=8) |
spolak | 0:d453d7554981 | 23 | { |
spolak | 0:d453d7554981 | 24 | pi.leds(i); |
spolak | 0:d453d7554981 | 25 | wait(0.2); |
spolak | 0:d453d7554981 | 26 | i=i*2; |
spolak | 0:d453d7554981 | 27 | n++; |
spolak | 0:d453d7554981 | 28 | } |
spolak | 0:d453d7554981 | 29 | |
spolak | 0:d453d7554981 | 30 | wait(1); |
spolak | 0:d453d7554981 | 31 | |
spolak | 0:d453d7554981 | 32 | i=1, n=0; |
spolak | 0:d453d7554981 | 33 | while(n!=8) |
spolak | 0:d453d7554981 | 34 | { |
spolak | 0:d453d7554981 | 35 | pi.leds(i); |
spolak | 0:d453d7554981 | 36 | wait(0.2); |
spolak | 0:d453d7554981 | 37 | i=i*2; |
spolak | 0:d453d7554981 | 38 | n++; |
spolak | 0:d453d7554981 | 39 | } |
spolak | 0:d453d7554981 | 40 | |
spolak | 0:d453d7554981 | 41 | pi.stop(); |
spolak | 0:d453d7554981 | 42 | wait(0.5); |
spolak | 0:d453d7554981 | 43 | |
spolak | 0:d453d7554981 | 44 | pi.right_motor(-0.5); |
spolak | 0:d453d7554981 | 45 | pi.left_motor(-0.2); |
spolak | 0:d453d7554981 | 46 | wait(0.5); |
spolak | 0:d453d7554981 | 47 | pi.left_motor(-0.5); |
spolak | 0:d453d7554981 | 48 | pi.right_motor(-0.2); |
spolak | 0:d453d7554981 | 49 | wait(0.5); |
spolak | 0:d453d7554981 | 50 | |
spolak | 0:d453d7554981 | 51 | |
spolak | 0:d453d7554981 | 52 | pi.stop(); |
spolak | 0:d453d7554981 | 53 | |
spolak | 0:d453d7554981 | 54 | } |