Tasten, LED; RGB und LDR Test
Dependencies: mbed
Fork of _Lektion_6 by
main.cpp@2:b09f7006a9b3, 2017-02-09 (annotated)
- Committer:
- Enenkel
- Date:
- Thu Feb 09 12:20:30 2017 +0000
- Revision:
- 2:b09f7006a9b3
- Parent:
- 1:d6e5f9c188d3
HIMINI TEST Software
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Enenkel | 2:b09f7006a9b3 | 1 | /* HIMINI_TEST1 |
Enenkel | 2:b09f7006a9b3 | 2 | BULME Graz, by Enenkel 1.2.2017 |
Enenkel | 2:b09f7006a9b3 | 3 | Diese Software testet das HIMINI. |
Enenkel | 2:b09f7006a9b3 | 4 | Notwendige Zusätze: 1) Die Testplatine von FL GOM |
Enenkel | 2:b09f7006a9b3 | 5 | 2) PC mit |
Enenkel | 2:b09f7006a9b3 | 6 | Prozessor einstellen auf LPC 11U68 ! |
Enenkel | 1:d6e5f9c188d3 | 7 | |
Enenkel | 2:b09f7006a9b3 | 8 | |
Enenkel | 2:b09f7006a9b3 | 9 | */ |
Enenkel | 0:7bf2f1754883 | 10 | #include "mbed.h" |
Enenkel | 1:d6e5f9c188d3 | 11 | // ******** Definitionen ********** |
Enenkel | 2:b09f7006a9b3 | 12 | Serial pc(USBTX, USBRX); // RxDO=P0_18 -> TxDO=P0_19 |
Enenkel | 1:d6e5f9c188d3 | 13 | |
Enenkel | 2:b09f7006a9b3 | 14 | // Definition der 28 LED's |
Enenkel | 2:b09f7006a9b3 | 15 | DigitalOut ledD1(P2_5); //Pin 4 |
Enenkel | 2:b09f7006a9b3 | 16 | DigitalOut ledD2(P0_20); |
Enenkel | 2:b09f7006a9b3 | 17 | DigitalOut ledD3(P0_2); //Pin 6 === ACHTUNG für FTDI reserviert ! |
Enenkel | 2:b09f7006a9b3 | 18 | DigitalOut ledD4(P2_2); |
Enenkel | 2:b09f7006a9b3 | 19 | DigitalOut ledD5(P1_20); |
Enenkel | 2:b09f7006a9b3 | 20 | DigitalOut ledD6(P0_4); |
Enenkel | 2:b09f7006a9b3 | 21 | DigitalOut ledD7(P0_5); |
Enenkel | 2:b09f7006a9b3 | 22 | DigitalOut ledD8(P0_21); |
Enenkel | 2:b09f7006a9b3 | 23 | DigitalOut ledD9(P1_23); |
Enenkel | 2:b09f7006a9b3 | 24 | DigitalOut ledD10(P2_7); |
Enenkel | 2:b09f7006a9b3 | 25 | DigitalOut ledD11(P1_24); |
Enenkel | 2:b09f7006a9b3 | 26 | DigitalOut ledD12(P0_6); |
Enenkel | 2:b09f7006a9b3 | 27 | DigitalOut ledD13(P0_7); |
Enenkel | 2:b09f7006a9b3 | 28 | DigitalOut ledD14(P1_21); |
Enenkel | 2:b09f7006a9b3 | 29 | DigitalOut ledD15(P0_8); |
Enenkel | 2:b09f7006a9b3 | 30 | DigitalOut ledD16(P0_9); |
Enenkel | 2:b09f7006a9b3 | 31 | DigitalOut ledD17(P0_5); |
Enenkel | 2:b09f7006a9b3 | 32 | DigitalOut ledD18(P0_10); //Pin20 |
Enenkel | 2:b09f7006a9b3 | 33 | // 2. Seite des HIMINI ! |
Enenkel | 2:b09f7006a9b3 | 34 | DigitalOut ledD19(P0_23); //Pin21 |
Enenkel | 2:b09f7006a9b3 | 35 | DigitalOut ledD20(P0_11); |
Enenkel | 2:b09f7006a9b3 | 36 | DigitalOut ledD21(P0_12); |
Enenkel | 2:b09f7006a9b3 | 37 | DigitalOut ledD22(P0_13); |
Enenkel | 2:b09f7006a9b3 | 38 | DigitalOut ledD23(P0_14); //Pin25 |
Enenkel | 2:b09f7006a9b3 | 39 | DigitalOut ledD24(P0_15); |
Enenkel | 2:b09f7006a9b3 | 40 | DigitalOut ledD25(P0_16); |
Enenkel | 2:b09f7006a9b3 | 41 | DigitalOut ledD26(P0_22); |
Enenkel | 2:b09f7006a9b3 | 42 | DigitalOut ledD27(P0_17); |
Enenkel | 2:b09f7006a9b3 | 43 | DigitalOut ledD28(P1_13); //Pin30 |
Enenkel | 1:d6e5f9c188d3 | 44 | |
Enenkel | 2:b09f7006a9b3 | 45 | int a; |
Enenkel | 0:7bf2f1754883 | 46 | |
Enenkel | 1:d6e5f9c188d3 | 47 | // Hauptprogramm |
Enenkel | 1:d6e5f9c188d3 | 48 | int main() |
Enenkel | 1:d6e5f9c188d3 | 49 | { |
Enenkel | 2:b09f7006a9b3 | 50 | ledD3=1; // schaltet den FTDI auf den USB Stecker! |
Enenkel | 2:b09f7006a9b3 | 51 | //char readChar = 0; |
Enenkel | 2:b09f7006a9b3 | 52 | pc.printf("Welcome to HIMINI\n\r"); |
Enenkel | 2:b09f7006a9b3 | 53 | wait (2); |
Enenkel | 1:d6e5f9c188d3 | 54 | |
Enenkel | 2:b09f7006a9b3 | 55 | |
Enenkel | 1:d6e5f9c188d3 | 56 | /********************* 2x Lauflicht der LEDS *************/ |
Enenkel | 2:b09f7006a9b3 | 57 | pc.printf("LAUFLICHT UBER 12 LED aktiv !\n\r"); |
Enenkel | 1:d6e5f9c188d3 | 58 | a=1; |
Enenkel | 1:d6e5f9c188d3 | 59 | while (a<3) { |
Enenkel | 1:d6e5f9c188d3 | 60 | ledD1=1; |
Enenkel | 1:d6e5f9c188d3 | 61 | wait(0.5); |
Enenkel | 1:d6e5f9c188d3 | 62 | ledD1=0; |
Enenkel | 1:d6e5f9c188d3 | 63 | ledD2=1; |
Enenkel | 1:d6e5f9c188d3 | 64 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 65 | ledD2=0; |
Enenkel | 1:d6e5f9c188d3 | 66 | ledD3=1; |
Enenkel | 1:d6e5f9c188d3 | 67 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 68 | ledD3=0; |
Enenkel | 1:d6e5f9c188d3 | 69 | ledD4=1; |
Enenkel | 1:d6e5f9c188d3 | 70 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 71 | ledD4=0; |
Enenkel | 2:b09f7006a9b3 | 72 | ledD5=1; |
Enenkel | 2:b09f7006a9b3 | 73 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 74 | ledD5=0; |
Enenkel | 2:b09f7006a9b3 | 75 | ledD6=1; |
Enenkel | 2:b09f7006a9b3 | 76 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 77 | ledD6=0; |
Enenkel | 2:b09f7006a9b3 | 78 | ledD7=1; |
Enenkel | 2:b09f7006a9b3 | 79 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 80 | ledD7=0; |
Enenkel | 2:b09f7006a9b3 | 81 | ledD8=1; |
Enenkel | 2:b09f7006a9b3 | 82 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 83 | ledD8=0; |
Enenkel | 2:b09f7006a9b3 | 84 | ledD9=1; |
Enenkel | 2:b09f7006a9b3 | 85 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 86 | ledD9=0; |
Enenkel | 2:b09f7006a9b3 | 87 | ledD10=1; |
Enenkel | 2:b09f7006a9b3 | 88 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 89 | ledD10=0; |
Enenkel | 2:b09f7006a9b3 | 90 | ledD11=1; |
Enenkel | 2:b09f7006a9b3 | 91 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 92 | ledD11=0; |
Enenkel | 2:b09f7006a9b3 | 93 | ledD12=1; |
Enenkel | 2:b09f7006a9b3 | 94 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 95 | ledD12=0; |
Enenkel | 1:d6e5f9c188d3 | 96 | ledD13=1; |
Enenkel | 1:d6e5f9c188d3 | 97 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 98 | ledD13=0; |
Enenkel | 1:d6e5f9c188d3 | 99 | ledD14=1; |
Enenkel | 1:d6e5f9c188d3 | 100 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 101 | ledD14=0; |
Enenkel | 1:d6e5f9c188d3 | 102 | ledD15=1; |
Enenkel | 1:d6e5f9c188d3 | 103 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 104 | ledD15=0; |
Enenkel | 1:d6e5f9c188d3 | 105 | ledD16=1; |
Enenkel | 1:d6e5f9c188d3 | 106 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 107 | ledD16=0; |
Enenkel | 1:d6e5f9c188d3 | 108 | ledD17=1; |
Enenkel | 1:d6e5f9c188d3 | 109 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 110 | ledD17=0; |
Enenkel | 1:d6e5f9c188d3 | 111 | ledD18=1; |
Enenkel | 1:d6e5f9c188d3 | 112 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 113 | ledD18=0; |
Enenkel | 1:d6e5f9c188d3 | 114 | ledD19=1; |
Enenkel | 1:d6e5f9c188d3 | 115 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 116 | ledD19=0; |
Enenkel | 1:d6e5f9c188d3 | 117 | ledD20=1; |
Enenkel | 1:d6e5f9c188d3 | 118 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 119 | ledD20=0; |
Enenkel | 2:b09f7006a9b3 | 120 | ledD21=1; |
Enenkel | 2:b09f7006a9b3 | 121 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 122 | ledD21=0; |
Enenkel | 2:b09f7006a9b3 | 123 | ledD22=1; |
Enenkel | 2:b09f7006a9b3 | 124 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 125 | ledD22=0; |
Enenkel | 2:b09f7006a9b3 | 126 | ledD23=1; |
Enenkel | 2:b09f7006a9b3 | 127 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 128 | ledD23=0; |
Enenkel | 2:b09f7006a9b3 | 129 | ledD24=1; |
Enenkel | 2:b09f7006a9b3 | 130 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 131 | ledD24=0; |
Enenkel | 2:b09f7006a9b3 | 132 | ledD25=1; |
Enenkel | 2:b09f7006a9b3 | 133 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 134 | ledD25=0; |
Enenkel | 2:b09f7006a9b3 | 135 | ledD26=1; |
Enenkel | 2:b09f7006a9b3 | 136 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 137 | ledD26=0; |
Enenkel | 2:b09f7006a9b3 | 138 | ledD27=1; |
Enenkel | 2:b09f7006a9b3 | 139 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 140 | ledD27=0; |
Enenkel | 2:b09f7006a9b3 | 141 | ledD28=1; |
Enenkel | 2:b09f7006a9b3 | 142 | wait (0.2); |
Enenkel | 2:b09f7006a9b3 | 143 | ledD28=0; |
Enenkel | 2:b09f7006a9b3 | 144 | wait (0.2); |
Enenkel | 1:d6e5f9c188d3 | 145 | a=a++; |
Enenkel | 1:d6e5f9c188d3 | 146 | } |
Enenkel | 2:b09f7006a9b3 | 147 | a=1; |
Enenkel | 2:b09f7006a9b3 | 148 | while (a<3) { |
Enenkel | 2:b09f7006a9b3 | 149 | ledD1=ledD2=ledD3=ledD4=ledD5=ledD6=ledD7=ledD8=ledD9=ledD10=0; |
Enenkel | 2:b09f7006a9b3 | 150 | ledD11=ledD12=ledD13=ledD13=ledD14=ledD15=ledD16=ledD17=0; |
Enenkel | 2:b09f7006a9b3 | 151 | ledD18=ledD19=ledD20=ledD21=ledD22=ledD23=ledD24=0; |
Enenkel | 2:b09f7006a9b3 | 152 | ledD25=ledD26=ledD27=ledD28=0; |
Enenkel | 2:b09f7006a9b3 | 153 | wait (5); |
Enenkel | 2:b09f7006a9b3 | 154 | ledD1=ledD2=ledD3=ledD4=ledD5=ledD6=ledD7=ledD8=ledD9=ledD10=1; |
Enenkel | 2:b09f7006a9b3 | 155 | ledD11=ledD12=ledD13=ledD13=ledD14=ledD15=ledD16=ledD17=1; |
Enenkel | 2:b09f7006a9b3 | 156 | ledD18=ledD19=ledD20=ledD21=ledD22=ledD23=ledD24=1; |
Enenkel | 2:b09f7006a9b3 | 157 | ledD25=ledD26=ledD27=ledD28=1; |
Enenkel | 2:b09f7006a9b3 | 158 | wait (5); |
Enenkel | 2:b09f7006a9b3 | 159 | a=a++; |
Enenkel | 2:b09f7006a9b3 | 160 | } |
Enenkel | 2:b09f7006a9b3 | 161 | ledD1=ledD2=ledD3=ledD4=ledD5=ledD6=ledD7=ledD8=ledD9=ledD10=0; |
Enenkel | 2:b09f7006a9b3 | 162 | ledD11=ledD12=ledD13=ledD13=ledD14=ledD15=ledD16=ledD17=0; |
Enenkel | 2:b09f7006a9b3 | 163 | ledD18=ledD19=ledD20=ledD21=ledD22=ledD23=ledD24=0; |
Enenkel | 2:b09f7006a9b3 | 164 | ledD25=ledD26=ledD27=ledD28=0; |
Enenkel | 2:b09f7006a9b3 | 165 | } |
Enenkel | 2:b09f7006a9b3 | 166 | |
Enenkel | 2:b09f7006a9b3 | 167 | |
Enenkel | 1:d6e5f9c188d3 | 168 | /************************** *********************/ |
Enenkel | 1:d6e5f9c188d3 | 169 | /* readChar = pc.getc(); |
Enenkel | 1:d6e5f9c188d3 | 170 | if(readChar >= 65 && readChar <= 90){ // Großbuchstaben in Kleinbuchstaben umwandeln |
Enenkel | 1:d6e5f9c188d3 | 171 | pc.putc(readChar + 32); |
Enenkel | 1:d6e5f9c188d3 | 172 | } else if(readChar >= 97 && readChar <= 122){ // Kleinbuchstaben in Großbuchstaben umwandeln |
Enenkel | 1:d6e5f9c188d3 | 173 | pc.putc(readChar - 32); |
Enenkel | 1:d6e5f9c188d3 | 174 | } else { // Sonst schicke was gekommen ist |
Enenkel | 1:d6e5f9c188d3 | 175 | pc.putc(readChar); |
Enenkel | 1:d6e5f9c188d3 | 176 | } |
Enenkel | 1:d6e5f9c188d3 | 177 | */ |
Enenkel | 1:d6e5f9c188d3 | 178 | |
Enenkel | 2:b09f7006a9b3 | 179 | |
Enenkel | 2:b09f7006a9b3 | 180 | |
Enenkel | 1:d6e5f9c188d3 | 181 | /******************** ENDE ***********************/ |