![](/media/cache/group/memeMan.png.50x50_q85.png)
Daniel Kahr
Dependencies: mbed
Fork of Lektion02b_Kahr by
main.cpp@2:46da9f6bc48c, 2016-01-06 (annotated)
- Committer:
- Enenkel
- Date:
- Wed Jan 06 12:40:59 2016 +0000
- Revision:
- 2:46da9f6bc48c
- Parent:
- 1:52e206dbe635
- Child:
- 3:6acee5d90cd0
Lauflicht ?ber 12 LED mit 1 LED + ?BUNGEN
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Enenkel | 0:fe5e1c689c26 | 1 | #include "mbed.h" |
Enenkel | 1:52e206dbe635 | 2 | // HIMBED Lektion_02b "Lauflicht über 12 LED" |
Enenkel | 0:fe5e1c689c26 | 3 | // by Gottfried ENENKEL 2014-12-12 |
Enenkel | 0:fe5e1c689c26 | 4 | // AUFGABE: |
Enenkel | 0:fe5e1c689c26 | 5 | // Verändere dis Software sie so, dass ein Lauflicht mit je 2 LED |
Enenkel | 0:fe5e1c689c26 | 6 | // über den 12 LED Balken des HIMBED entsteht |
Enenkel | 0:fe5e1c689c26 | 7 | // Das Lauflicht soll hin und her gleiten. |
Enenkel | 0:fe5e1c689c26 | 8 | // Am Anfang und am Ende sollen alle LED aus sein. |
Enenkel | 0:fe5e1c689c26 | 9 | // |
Enenkel | 0:fe5e1c689c26 | 10 | // DEFINITIONEN ************************************************* |
Enenkel | 0:fe5e1c689c26 | 11 | // Ausgange definieren: |
Enenkel | 0:fe5e1c689c26 | 12 | DigitalOut LedD1 (P1_8); |
Enenkel | 0:fe5e1c689c26 | 13 | DigitalOut LedD2 (P1_9); |
Enenkel | 0:fe5e1c689c26 | 14 | //DigitalOut LedD3 (guckst du in Schalplan! |
Enenkel | 0:fe5e1c689c26 | 15 | //DigitalOut LedD4 (gucktst du nochmals in Schaltplan! |
Enenkel | 0:fe5e1c689c26 | 16 | DigitalOut LedD13 (P1_0); //D13 geht auf EP10 und dieser auf Port0 Pin0 |
Enenkel | 0:fe5e1c689c26 | 17 | DigitalOut LedD14 (P1_1); |
Enenkel | 0:fe5e1c689c26 | 18 | // hier ergänzen bis D20 |
Enenkel | 0:fe5e1c689c26 | 19 | |
Enenkel | 0:fe5e1c689c26 | 20 | // HAUPTPROGRAMM *********************************************** |
Enenkel | 2:46da9f6bc48c | 21 | int main() |
Enenkel | 2:46da9f6bc48c | 22 | { |
Enenkel | 0:fe5e1c689c26 | 23 | while(1) // Hauptschleife |
Enenkel | 0:fe5e1c689c26 | 24 | { |
Enenkel | 0:fe5e1c689c26 | 25 | LedD1=1; // LED D1 EIN |
Enenkel | 0:fe5e1c689c26 | 26 | wait(0.4); // warte 0.4 sec |
Enenkel | 0:fe5e1c689c26 | 27 | LedD2=1; // LED D2 EIN |
Enenkel | 0:fe5e1c689c26 | 28 | wait (0.4); // warte 0.4 sec |
Enenkel | 0:fe5e1c689c26 | 29 | LedD1=0; |
Enenkel | 0:fe5e1c689c26 | 30 | |
Enenkel | 0:fe5e1c689c26 | 31 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 32 | LedD2 = 0; |
Enenkel | 0:fe5e1c689c26 | 33 | |
Enenkel | 0:fe5e1c689c26 | 34 | // schreibe hier deine Software! |
Enenkel | 0:fe5e1c689c26 | 35 | // sinnvoll hier weiter schreiben! |
Enenkel | 0:fe5e1c689c26 | 36 | LedD13=1; |
Enenkel | 0:fe5e1c689c26 | 37 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 38 | LedD14=1; |
Enenkel | 0:fe5e1c689c26 | 39 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 40 | LedD13=0; |
Enenkel | 0:fe5e1c689c26 | 41 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 42 | LedD14=0; |
Enenkel | 2:46da9f6bc48c | 43 | |
Enenkel | 0:fe5e1c689c26 | 44 | |
Enenkel | 0:fe5e1c689c26 | 45 | |
Enenkel | 0:fe5e1c689c26 | 46 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 47 | |
Enenkel | 0:fe5e1c689c26 | 48 | |
Enenkel | 0:fe5e1c689c26 | 49 | } |
Enenkel | 0:fe5e1c689c26 | 50 | } |
Enenkel | 0:fe5e1c689c26 | 51 | // ENDE ***************************************************** |
Enenkel | 2:46da9f6bc48c | 52 | /* ++++++++++ ÜBUNGEN ++++++++++++ |
Enenkel | 2:46da9f6bc48c | 53 | Erstelle eine Software, welche im 0.5 Sec Takt |
Enenkel | 2:46da9f6bc48c | 54 | die in der jeweiligen Var. angegebenen Sequenzen abarbeitet. |
Enenkel | 2:46da9f6bc48c | 55 | x = LED ON |
Enenkel | 2:46da9f6bc48c | 56 | Var.1 Var.2 |
Enenkel | 2:46da9f6bc48c | 57 | 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 |
Enenkel | 2:46da9f6bc48c | 58 | D1 x x x - - - - - - - - x - - - - - - - x x x - x |
Enenkel | 2:46da9f6bc48c | 59 | D2 - x x x - - - - - - - x - - - - - - x x x - - x |
Enenkel | 2:46da9f6bc48c | 60 | D3 - - x x x - - - - - - x - - - - - x x x - - - x |
Enenkel | 2:46da9f6bc48c | 61 | D4 - - - x x x - - - - - x - - - - x x x - - - - x |
Enenkel | 2:46da9f6bc48c | 62 | D13 - - - - x x x - - - - x - - - x x x - - - - - x |
Enenkel | 2:46da9f6bc48c | 63 | D14 - - - - - x x x - - - x - - x x x - - - - - - x |
Enenkel | 2:46da9f6bc48c | 64 | D15 - - - - - - x x x - - x - x x x - - - - - - - x |
Enenkel | 2:46da9f6bc48c | 65 | D16 - - - - - - - x x x - x x x x - - - - - - - - x |
Enenkel | 0:fe5e1c689c26 | 66 | |
Enenkel | 2:46da9f6bc48c | 67 | Var.3 Var.4 |
Enenkel | 2:46da9f6bc48c | 68 | 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 |
Enenkel | 2:46da9f6bc48c | 69 | D1 x x x x - - - - - - - - - - - - - - - x x x x - |
Enenkel | 2:46da9f6bc48c | 70 | D2 - x x x x - - - - - - - - - - - - - x x x x - - |
Enenkel | 2:46da9f6bc48c | 71 | D3 - - x x x x - - - - - - - - - - - x x x x - - - |
Enenkel | 2:46da9f6bc48c | 72 | D4 - - - x x x x - - - - - - - - - x x x x - - - - |
Enenkel | 2:46da9f6bc48c | 73 | D13 - - - x x x x x - - - - - - - x x x x - - - - - |
Enenkel | 2:46da9f6bc48c | 74 | D14 - - - - x x x x x - - - - - x x x x - - - - - - |
Enenkel | 2:46da9f6bc48c | 75 | D15 - - - - - x x x x x - - - x x x x - - - - - - - |
Enenkel | 2:46da9f6bc48c | 76 | D16 - - - - - - x x x x x - x x x x - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 77 | |
Enenkel | 2:46da9f6bc48c | 78 | Var.5 Var.6 |
Enenkel | 2:46da9f6bc48c | 79 | 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 |
Enenkel | 2:46da9f6bc48c | 80 | D1 x x x - - - - - - - x x x - - - - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 81 | D2 - x x x - - - - - x x - - x - - - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 82 | D3 - - x x x - - - x x - - - - x - - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 83 | D4 - - - x x x - x x - - - - - - x - - - - - - - x |
Enenkel | 2:46da9f6bc48c | 84 | D13 - - - x x x - x x - - - - - - - x - - - - - x - |
Enenkel | 2:46da9f6bc48c | 85 | D14 - - x x x - - - x x - - - - - - - x - - - x - - |
Enenkel | 2:46da9f6bc48c | 86 | D15 - x x x - - - - - x x - - - - - - - x - x - - - |
Enenkel | 2:46da9f6bc48c | 87 | D16 x x x - - - - - - - x x - - - - - - - x - - - - |
Enenkel | 2:46da9f6bc48c | 88 | |
Enenkel | 2:46da9f6bc48c | 89 | |
Enenkel | 2:46da9f6bc48c | 90 | Var.7 Var.8 |
Enenkel | 2:46da9f6bc48c | 91 | 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 |
Enenkel | 2:46da9f6bc48c | 92 | D1 x - - - - - x - - - x - - - - x - x - x - - - x |
Enenkel | 2:46da9f6bc48c | 93 | D2 x - - - - - x - - - x - - - - x - x - x - - - x |
Enenkel | 2:46da9f6bc48c | 94 | D3 - x - - - x - x - - x - - - x - - x - - x - - x |
Enenkel | 2:46da9f6bc48c | 95 | D4 - x - - - x - x - - x - - - x - - x - - x - - x |
Enenkel | 2:46da9f6bc48c | 96 | D13 - - x - x - - - x - x - - x - - - x - - - x - x |
Enenkel | 2:46da9f6bc48c | 97 | D14 - - x - x - - - x - x - - x - - - x - - - x - - x |
Enenkel | 2:46da9f6bc48c | 98 | D15 - - - x - - - - - x x - x - - - - x - - - - x - x |
Enenkel | 2:46da9f6bc48c | 99 | D16 - - - x - - - - - x x - x - - - - x - - - - x - x |
Enenkel | 2:46da9f6bc48c | 100 | |
Enenkel | 2:46da9f6bc48c | 101 | ********************** ENDE ***********************************/ |