Hans-Peter Wipfler
/
Kitt_licht
Kitt light Knight 2000
Revision 0:ab33946a7709, committed 2016-10-24
- Comitter:
- wipflhan
- Date:
- Mon Oct 24 15:31:34 2016 +0000
- Commit message:
- Knight2000;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r ab33946a7709 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 24 15:31:34 2016 +0000 @@ -0,0 +1,89 @@ +#include "mbed.h" + + + + +// LSB... ...MSB +// 2^0 2^1 ........... +BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1); +// D20 D19 D18..... + + + +void LedBarTest(); +void Lauflicht(); +void einschieben(int anzahl); +void rechtsschieben(int anzahl); +void linksschieben(int anzahlt); +int zeit = 25; + + + + +int main() +{ + bool flag = true; + lb = 1; + wait_ms(zeit); + einschieben(2); + while(lb != 0) { + if (flag == true)zeit *= 2; + else zeit /=2; + + linksschieben(9); + rechtsschieben(9); + flag = !flag; + } + +} + +//void LedBarTest() +//{ + // lb = 1; //D20 setzen + // wait_ms(500); + // lb = 2; //D19 setzen + // wait_ms(500); + // lb = 3; //D20 & 19setzen + // wait_ms(500); + // lb = 4; // setzen + // wait_ms(500); + +//} + +void Lauflicht() +{ + lb = 1; + wait_ms(zeit); + while(lb != 0) { + + lb = lb <<1; + wait_ms(zeit); + } + +} + +void einschieben(int anzahl) +{ + for(int i = 0; i < anzahl; i++) { + lb = lb << 1; + lb = lb | 1; + wait_ms(zeit); + } +} + + +void linksschieben(int anzahl) +{ + for(int i = 0; i < anzahl; i++) { + lb = lb << 1; + wait_ms(zeit); + } +} + +void rechtsschieben(int anzahl) +{ + for(int i = 0; i < anzahl; i++) { + lb = lb >> 1; + wait_ms(zeit); + } +} \ No newline at end of file
diff -r 000000000000 -r ab33946a7709 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 24 15:31:34 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file