![](/media/cache/group/memeMan.png.50x50_q85.png)
Daniel Kahr
Dependencies: mbed
Fork of Lektion02b_Kahr by
main.cpp@3:6acee5d90cd0, 2016-01-29 (annotated)
- Committer:
- DanielKahr
- Date:
- Fri Jan 29 08:58:21 2016 +0000
- Revision:
- 3:6acee5d90cd0
- Parent:
- 2:46da9f6bc48c
- Child:
- 4:25f04078bca4
MO Board 02b
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); |
DanielKahr | 3:6acee5d90cd0 | 14 | DigitalOut LedD3 (P1_10); |
DanielKahr | 3:6acee5d90cd0 | 15 | DigitalOut LedD4 (P1_11); |
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); |
DanielKahr | 3:6acee5d90cd0 | 18 | DigitalOut LedD15 (P1_3); |
DanielKahr | 3:6acee5d90cd0 | 19 | DigitalOut LedD16 (P1_4); |
DanielKahr | 3:6acee5d90cd0 | 20 | DigitalOut LedD17 (P1_6); |
DanielKahr | 3:6acee5d90cd0 | 21 | DigitalOut LedD18 (P1_7); |
DanielKahr | 3:6acee5d90cd0 | 22 | DigitalOut LedD19 (P1_12); |
DanielKahr | 3:6acee5d90cd0 | 23 | DigitalOut LedD20 (P1_13); |
Enenkel | 0:fe5e1c689c26 | 24 | // hier ergänzen bis D20 |
Enenkel | 0:fe5e1c689c26 | 25 | |
Enenkel | 0:fe5e1c689c26 | 26 | // HAUPTPROGRAMM *********************************************** |
Enenkel | 2:46da9f6bc48c | 27 | int main() |
Enenkel | 2:46da9f6bc48c | 28 | { |
Enenkel | 0:fe5e1c689c26 | 29 | while(1) // Hauptschleife |
Enenkel | 0:fe5e1c689c26 | 30 | { |
Enenkel | 0:fe5e1c689c26 | 31 | LedD1=1; // LED D1 EIN |
Enenkel | 0:fe5e1c689c26 | 32 | wait(0.4); // warte 0.4 sec |
Enenkel | 0:fe5e1c689c26 | 33 | LedD2=1; // LED D2 EIN |
Enenkel | 0:fe5e1c689c26 | 34 | wait (0.4); // warte 0.4 sec |
Enenkel | 0:fe5e1c689c26 | 35 | LedD1=0; |
DanielKahr | 3:6acee5d90cd0 | 36 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 37 | LedD2=0; |
DanielKahr | 3:6acee5d90cd0 | 38 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 39 | LedD3=1; |
Enenkel | 0:fe5e1c689c26 | 40 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 41 | LedD4=1; |
DanielKahr | 3:6acee5d90cd0 | 42 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 43 | LedD3=0; |
DanielKahr | 3:6acee5d90cd0 | 44 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 45 | LedD4=0; |
DanielKahr | 3:6acee5d90cd0 | 46 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 47 | LedD13=1; |
Enenkel | 0:fe5e1c689c26 | 48 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 49 | LedD14=1; |
Enenkel | 0:fe5e1c689c26 | 50 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 51 | LedD13=0; |
Enenkel | 0:fe5e1c689c26 | 52 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 53 | LedD14=0; |
DanielKahr | 3:6acee5d90cd0 | 54 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 55 | LedD15=1; |
DanielKahr | 3:6acee5d90cd0 | 56 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 57 | LedD16=1; |
DanielKahr | 3:6acee5d90cd0 | 58 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 59 | LedD15=0; |
DanielKahr | 3:6acee5d90cd0 | 60 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 61 | LedD16=0; |
DanielKahr | 3:6acee5d90cd0 | 62 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 63 | LedD17=1; |
DanielKahr | 3:6acee5d90cd0 | 64 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 65 | LedD18=1; |
DanielKahr | 3:6acee5d90cd0 | 66 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 67 | LedD17=0; |
DanielKahr | 3:6acee5d90cd0 | 68 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 69 | LedD18=0; |
DanielKahr | 3:6acee5d90cd0 | 70 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 71 | LedD19=1; |
DanielKahr | 3:6acee5d90cd0 | 72 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 73 | LedD20=1; |
DanielKahr | 3:6acee5d90cd0 | 74 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 75 | LedD19=0; |
DanielKahr | 3:6acee5d90cd0 | 76 | wait (0.4); |
DanielKahr | 3:6acee5d90cd0 | 77 | LedD20=0; |
DanielKahr | 3:6acee5d90cd0 | 78 | |
Enenkel | 2:46da9f6bc48c | 79 | |
Enenkel | 0:fe5e1c689c26 | 80 | |
Enenkel | 0:fe5e1c689c26 | 81 | |
Enenkel | 0:fe5e1c689c26 | 82 | wait (0.4); |
Enenkel | 0:fe5e1c689c26 | 83 | |
Enenkel | 0:fe5e1c689c26 | 84 | |
Enenkel | 0:fe5e1c689c26 | 85 | } |
Enenkel | 0:fe5e1c689c26 | 86 | } |
Enenkel | 0:fe5e1c689c26 | 87 | // ENDE ***************************************************** |
Enenkel | 2:46da9f6bc48c | 88 | /* ++++++++++ ÜBUNGEN ++++++++++++ |
Enenkel | 2:46da9f6bc48c | 89 | Erstelle eine Software, welche im 0.5 Sec Takt |
Enenkel | 2:46da9f6bc48c | 90 | die in der jeweiligen Var. angegebenen Sequenzen abarbeitet. |
Enenkel | 2:46da9f6bc48c | 91 | x = LED ON |
Enenkel | 2:46da9f6bc48c | 92 | Var.1 Var.2 |
Enenkel | 2:46da9f6bc48c | 93 | 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 | 94 | D1 x x x - - - - - - - - x - - - - - - - x x x - x |
Enenkel | 2:46da9f6bc48c | 95 | D2 - x x x - - - - - - - x - - - - - - x x x - - x |
Enenkel | 2:46da9f6bc48c | 96 | D3 - - x x x - - - - - - x - - - - - x x x - - - x |
Enenkel | 2:46da9f6bc48c | 97 | D4 - - - x x x - - - - - x - - - - x x x - - - - x |
Enenkel | 2:46da9f6bc48c | 98 | D13 - - - - x x x - - - - x - - - x x x - - - - - x |
Enenkel | 2:46da9f6bc48c | 99 | D14 - - - - - x x x - - - x - - x x x - - - - - - x |
Enenkel | 2:46da9f6bc48c | 100 | D15 - - - - - - x x x - - x - x x x - - - - - - - x |
Enenkel | 2:46da9f6bc48c | 101 | D16 - - - - - - - x x x - x x x x - - - - - - - - x |
Enenkel | 0:fe5e1c689c26 | 102 | |
Enenkel | 2:46da9f6bc48c | 103 | Var.3 Var.4 |
Enenkel | 2:46da9f6bc48c | 104 | 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 | 105 | D1 x x x x - - - - - - - - - - - - - - - x x x x - |
Enenkel | 2:46da9f6bc48c | 106 | D2 - x x x x - - - - - - - - - - - - - x x x x - - |
Enenkel | 2:46da9f6bc48c | 107 | D3 - - x x x x - - - - - - - - - - - x x x x - - - |
Enenkel | 2:46da9f6bc48c | 108 | D4 - - - x x x x - - - - - - - - - x x x x - - - - |
Enenkel | 2:46da9f6bc48c | 109 | D13 - - - x x x x x - - - - - - - x x x x - - - - - |
Enenkel | 2:46da9f6bc48c | 110 | D14 - - - - x x x x x - - - - - x x x x - - - - - - |
Enenkel | 2:46da9f6bc48c | 111 | D15 - - - - - x x x x x - - - x x x x - - - - - - - |
Enenkel | 2:46da9f6bc48c | 112 | D16 - - - - - - x x x x x - x x x x - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 113 | |
Enenkel | 2:46da9f6bc48c | 114 | Var.5 Var.6 |
Enenkel | 2:46da9f6bc48c | 115 | 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 | 116 | D1 x x x - - - - - - - x x x - - - - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 117 | D2 - x x x - - - - - x x - - x - - - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 118 | D3 - - x x x - - - x x - - - - x - - - - - - - - - |
Enenkel | 2:46da9f6bc48c | 119 | D4 - - - x x x - x x - - - - - - x - - - - - - - x |
Enenkel | 2:46da9f6bc48c | 120 | D13 - - - x x x - x x - - - - - - - x - - - - - x - |
Enenkel | 2:46da9f6bc48c | 121 | D14 - - x x x - - - x x - - - - - - - x - - - x - - |
Enenkel | 2:46da9f6bc48c | 122 | D15 - x x x - - - - - x x - - - - - - - x - x - - - |
Enenkel | 2:46da9f6bc48c | 123 | D16 x x x - - - - - - - x x - - - - - - - x - - - - |
Enenkel | 2:46da9f6bc48c | 124 | |
Enenkel | 2:46da9f6bc48c | 125 | |
Enenkel | 2:46da9f6bc48c | 126 | Var.7 Var.8 |
Enenkel | 2:46da9f6bc48c | 127 | 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 | 128 | D1 x - - - - - x - - - x - - - - x - x - x - - - x |
Enenkel | 2:46da9f6bc48c | 129 | D2 x - - - - - x - - - x - - - - x - x - x - - - x |
Enenkel | 2:46da9f6bc48c | 130 | D3 - x - - - x - x - - x - - - x - - x - - x - - x |
Enenkel | 2:46da9f6bc48c | 131 | D4 - x - - - x - x - - x - - - x - - x - - x - - x |
Enenkel | 2:46da9f6bc48c | 132 | D13 - - x - x - - - x - x - - x - - - x - - - x - x |
Enenkel | 2:46da9f6bc48c | 133 | D14 - - x - x - - - x - x - - x - - - x - - - x - - x |
Enenkel | 2:46da9f6bc48c | 134 | D15 - - - x - - - - - x x - x - - - - x - - - - x - x |
Enenkel | 2:46da9f6bc48c | 135 | D16 - - - x - - - - - x x - x - - - - x - - - - x - x |
Enenkel | 2:46da9f6bc48c | 136 | |
Enenkel | 2:46da9f6bc48c | 137 | ********************** ENDE ***********************************/ |