Stefan Seebacher
/
M0_Uebung_4
M0_Übung_4
Fork of M0_Lektion04 by
main.cpp@1:9cf12e837f53, 2016-04-21 (annotated)
- Committer:
- StefanSeebacher
- Date:
- Thu Apr 21 07:55:07 2016 +0000
- Revision:
- 1:9cf12e837f53
- Parent:
- 0:37878a820003
M0_?bung_4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
StefanSeebacher | 1:9cf12e837f53 | 1 | #include "mbed.h" |
StefanSeebacher | 1:9cf12e837f53 | 2 | |
StefanSeebacher | 1:9cf12e837f53 | 3 | // **** DEFINITIONEN **** |
StefanSeebacher | 1:9cf12e837f53 | 4 | |
StefanSeebacher | 1:9cf12e837f53 | 5 | DigitalOut ledGR(p5); |
StefanSeebacher | 1:9cf12e837f53 | 6 | DigitalOut ledBL(p34); |
StefanSeebacher | 1:9cf12e837f53 | 7 | DigitalOut ledRT(p36); |
StefanSeebacher | 1:9cf12e837f53 | 8 | |
StefanSeebacher | 1:9cf12e837f53 | 9 | BusOut led(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1); |
StefanSeebacher | 1:9cf12e837f53 | 10 | |
StefanSeebacher | 1:9cf12e837f53 | 11 | // **** HAUPTPROGRAMM **** |
StefanSeebacher | 1:9cf12e837f53 | 12 | |
StefanSeebacher | 1:9cf12e837f53 | 13 | int main() |
StefanSeebacher | 1:9cf12e837f53 | 14 | { |
StefanSeebacher | 1:9cf12e837f53 | 15 | while(1) |
StefanSeebacher | 1:9cf12e837f53 | 16 | { |
StefanSeebacher | 1:9cf12e837f53 | 17 | ledGR = 1; |
StefanSeebacher | 1:9cf12e837f53 | 18 | ledBL = 1; |
StefanSeebacher | 1:9cf12e837f53 | 19 | ledRT = 1; |
StefanSeebacher | 1:9cf12e837f53 | 20 | |
StefanSeebacher | 1:9cf12e837f53 | 21 | led=0x000; //LED **** **** **** 0000 0000 0000 |
StefanSeebacher | 1:9cf12e837f53 | 22 | wait(0.2); |
StefanSeebacher | 1:9cf12e837f53 | 23 | led=0x001; //LED **** **** ***X 0000 0000 0001 |
StefanSeebacher | 1:9cf12e837f53 | 24 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 25 | led=0x003; //LED **** **** **XX 0000 0000 0011 |
StefanSeebacher | 1:9cf12e837f53 | 26 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 27 | led=0x007; //LED **** **** *XXX 0000 0000 0111 |
StefanSeebacher | 1:9cf12e837f53 | 28 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 29 | led=0x00E; //LED **** **** XXX* 0000 0000 1110 |
StefanSeebacher | 1:9cf12e837f53 | 30 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 31 | led=0x01C; //LED **** ***X XX** 0000 0001 1100 |
StefanSeebacher | 1:9cf12e837f53 | 32 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 33 | led=0x038; //LED **** **XX X*** 0000 0011 1000 |
StefanSeebacher | 1:9cf12e837f53 | 34 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 35 | led=0x070; //LED **** *XXX **** 0000 0111 0000 |
StefanSeebacher | 1:9cf12e837f53 | 36 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 37 | led=0x0E0; //LED **** XXX* **** 0000 1110 0000 |
StefanSeebacher | 1:9cf12e837f53 | 38 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 39 | led=0x1C0; //LED ***X XX** **** 0001 1100 0000 |
StefanSeebacher | 1:9cf12e837f53 | 40 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 41 | led=0x380; //LED **XX X*** **** 0011 1000 0000 |
StefanSeebacher | 1:9cf12e837f53 | 42 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 43 | led=0x700; //LED *XXX **** **** 0111 0000 0000 |
StefanSeebacher | 1:9cf12e837f53 | 44 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 45 | led=0xE00; //LED XXX* **** **** 1110 0000 0000 |
StefanSeebacher | 1:9cf12e837f53 | 46 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 47 | led=0xC00; //LED XX** **** **** 1100 0000 0000 |
StefanSeebacher | 1:9cf12e837f53 | 48 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 49 | led=0x800; //LED X*** **** **** 1000 0000 0000 |
StefanSeebacher | 1:9cf12e837f53 | 50 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 51 | led=0x000; //LED **** **** **** 0000 0000 0000 |
StefanSeebacher | 1:9cf12e837f53 | 52 | wait (0.2); |
StefanSeebacher | 1:9cf12e837f53 | 53 | |
StefanSeebacher | 1:9cf12e837f53 | 54 | ledGR = 1; |
StefanSeebacher | 1:9cf12e837f53 | 55 | ledBL = 0; |
StefanSeebacher | 1:9cf12e837f53 | 56 | ledRT = 1; |
StefanSeebacher | 1:9cf12e837f53 | 57 | wait(1); |
StefanSeebacher | 1:9cf12e837f53 | 58 | |
StefanSeebacher | 1:9cf12e837f53 | 59 | ledGR = 1; |
StefanSeebacher | 1:9cf12e837f53 | 60 | ledBL = 1; |
StefanSeebacher | 1:9cf12e837f53 | 61 | ledRT = 0; |
StefanSeebacher | 1:9cf12e837f53 | 62 | wait(1); |
StefanSeebacher | 1:9cf12e837f53 | 63 | |
StefanSeebacher | 1:9cf12e837f53 | 64 | ledGR = 0; |
StefanSeebacher | 1:9cf12e837f53 | 65 | ledBL = 1; |
StefanSeebacher | 1:9cf12e837f53 | 66 | ledRT = 1; |
StefanSeebacher | 1:9cf12e837f53 | 67 | wait(1); |
StefanSeebacher | 1:9cf12e837f53 | 68 | |
StefanSeebacher | 1:9cf12e837f53 | 69 | ledGR = 1; |
StefanSeebacher | 1:9cf12e837f53 | 70 | ledBL = 1; |
StefanSeebacher | 1:9cf12e837f53 | 71 | ledRT = 1; |
StefanSeebacher | 1:9cf12e837f53 | 72 | wait(2); |
StefanSeebacher | 1:9cf12e837f53 | 73 | |
StefanSeebacher | 1:9cf12e837f53 | 74 | } |
StefanSeebacher | 1:9cf12e837f53 | 75 | } |
StefanSeebacher | 1:9cf12e837f53 | 76 | // **** ENDE **** |