Lauflicht
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:a3de19617095
diff -r 000000000000 -r a3de19617095 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Nov 16 18:09:11 2015 +0000 @@ -0,0 +1,89 @@ +#include "mbed.h" + +BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1); // BusOut 1 Variable für eine Bitgruppe (mit 16Bit) + +void LedBarTest1(); +void RunLight1(); +void RunLight2(); +void RunLight3(); +void RunLight4(); +int main() +{ + while(1) + { + RunLight4(); + + } +} + + +void LedBarTest1() +{ + lb=1; // D20 setzen + wait_ms(500); + lb=2;//D19 setzten + wait_ms(500); + lb=3;// D20 und D19 + wait_ms(500); + lb=4;// D18 setzten + wait_ms(500); + +} + +void RunLight1() +{ + int i; + lb=1; // 2^0 Bit setzen + wait_ms(200); + for(i=1; i<=11; i++) + { + lb=lb << 1; + wait_ms(200); + } + +} + +void RunLight2() +{ + int i; + lb=2048; + wait_ms(200); + for(i=1; i<=11; i++) + { + lb=lb >> 1; + wait_ms(200); + } +} + +void RunLight3() +{ + int i; + lb=0xFFFF; + wait_ms(200); + for(i=1; i<=11; i++) + { + lb=lb << 1; + wait_ms(200); + } + +} + +void RunLight4() +{ + int i; + lb=1; + wait_ms(200); + for (i=1;i<=2;i++) + { + lb=lb<<1; + lb=lb|1; + wait_ms(200); + } + + + for(i=1;i<=11;i++) + { + lb=lb <<1; + wait_ms(200); + } +} \ No newline at end of file