florian schriebl
/
DIC_Pruefung_Bienentanz
Prüfung
main.cpp@0:b050d3fef5fb, 2016-06-20 (annotated)
- Committer:
- Nutria
- Date:
- Mon Jun 20 13:00:04 2016 +0000
- Revision:
- 0:b050d3fef5fb
Pr?fung
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nutria | 0:b050d3fef5fb | 1 | #include "mbed.h" |
Nutria | 0:b050d3fef5fb | 2 | #include "bertl14.h" |
Nutria | 0:b050d3fef5fb | 3 | // Lassen Sie ihn schräg starten |
Nutria | 0:b050d3fef5fb | 4 | unsigned taster; // Taster Variable |
Nutria | 0:b050d3fef5fb | 5 | DigitalOut led1(LED1); |
Nutria | 0:b050d3fef5fb | 6 | int main() |
Nutria | 0:b050d3fef5fb | 7 | { |
Nutria | 0:b050d3fef5fb | 8 | bertl_PC9555_init(); |
Nutria | 0:b050d3fef5fb | 9 | while(1) { |
Nutria | 0:b050d3fef5fb | 10 | |
Nutria | 0:b050d3fef5fb | 11 | |
Nutria | 0:b050d3fef5fb | 12 | taster = bertl_PC9555_switches(); // Ob Taster gedrückt sind |
Nutria | 0:b050d3fef5fb | 13 | |
Nutria | 0:b050d3fef5fb | 14 | if (taster == TASTER_F) { // Wenn eine vordere Taste gedrückt wurde bleibt er 1 sec. stehen |
Nutria | 0:b050d3fef5fb | 15 | bertl_engine(0,0); |
Nutria | 0:b050d3fef5fb | 16 | wait (1.0); |
Nutria | 0:b050d3fef5fb | 17 | } else { |
Nutria | 0:b050d3fef5fb | 18 | for (int i=0; i <6; i++) |
Nutria | 0:b050d3fef5fb | 19 | { |
Nutria | 0:b050d3fef5fb | 20 | |
Nutria | 0:b050d3fef5fb | 21 | bertl_engine(100,100); |
Nutria | 0:b050d3fef5fb | 22 | wait(0.3); |
Nutria | 0:b050d3fef5fb | 23 | bertl_PC9555_leds(LED_F_ALL); |
Nutria | 0:b050d3fef5fb | 24 | bertl_engine(0,100); // Ausgleich da rechter Motor schwächer als links |
Nutria | 0:b050d3fef5fb | 25 | wait(0.6); |
Nutria | 0:b050d3fef5fb | 26 | bertl_PC9555_leds(LED_OFF); |
Nutria | 0:b050d3fef5fb | 27 | bertl_engine(100,100); |
Nutria | 0:b050d3fef5fb | 28 | wait(0.3); |
Nutria | 0:b050d3fef5fb | 29 | bertl_PC9555_leds(LED_F_ALL); |
Nutria | 0:b050d3fef5fb | 30 | bertl_engine(100,0); |
Nutria | 0:b050d3fef5fb | 31 | wait(0.49); |
Nutria | 0:b050d3fef5fb | 32 | bertl_PC9555_leds(LED_OFF); |
Nutria | 0:b050d3fef5fb | 33 | } |
Nutria | 0:b050d3fef5fb | 34 | bertl_engine(-100,100); // Vorbereitung für Halbreis zum Ausgangspunkt |
Nutria | 0:b050d3fef5fb | 35 | wait(0.4); |
Nutria | 0:b050d3fef5fb | 36 | bertl_engine(60,100); // Halbkreis |
Nutria | 0:b050d3fef5fb | 37 | wait(12.0); |
Nutria | 0:b050d3fef5fb | 38 | bertl_engine(-100,100); |
Nutria | 0:b050d3fef5fb | 39 | wait(0.4); // in Startposition bringen |
Nutria | 0:b050d3fef5fb | 40 | } |
Nutria | 0:b050d3fef5fb | 41 | } |
Nutria | 0:b050d3fef5fb | 42 | } |
Nutria | 0:b050d3fef5fb | 43 |