Hans-Peter Wipfler
/
Buttontest
Buttontest
Revision 0:c77311b3735e, committed 2016-10-24
- Comitter:
- wipflhan
- Date:
- Mon Oct 24 16:00:53 2016 +0000
- Commit message:
- kkd;
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 c77311b3735e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 24 16:00:53 2016 +0000 @@ -0,0 +1,30 @@ +#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..... + +BusIn btn(P0_10, P0_15, P0_23, P1_16); +int main() { + lb = 0;//alle Leds aus + + while(1) + { + if (btn & 1)//wenn sw1 gedrückt + lb = lb | 4; + + if (btn & 2)//wenn sw2 gedrückt + lb = lb | 8; + + if (btn & 4)//wenn sw2 gedrückt + lb = lb | 16; + + if (btn & 8)//wenn sw2 gedrückt + lb = lb | 32; + + wait_ms(100); + lb = 0; + wait_ms(100); + + } +}
diff -r 000000000000 -r c77311b3735e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 24 16:00:53 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file