Matthaeus Vorraber
/
Button_runlight_Interrupt
Button_runlight_Interrupt
Revision 0:bf64b77eb9c9, committed 2020-01-13
- Comitter:
- happy_alien
- Date:
- Mon Jan 13 03:38:59 2020 +0000
- Commit message:
- Interrupts oben defiieren und verschieden Lauflichter generieren.
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 bf64b77eb9c9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jan 13 03:38:59 2020 +0000 @@ -0,0 +1,45 @@ +#include "mbed.h" + + // D20,D19,D18,D17,... +BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1); + + // Sw4 als Interrupt definieren +InterruptIn sw4(P1_16); + + +void OneRunLightStep2(); + +void ButtonISR() +{ + if(sw4.read()==1) + OneRunLightStep2(); +} + +int main() + +{ + sw4.rise(ButtonISR); + while(1) + { + } + +} + + +void OneRunLightStep2() +{ + if(lb==0) + lb=1; + else + lb=lb<<1; // Finster +} + + + + + + + + + +
diff -r 000000000000 -r bf64b77eb9c9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Jan 13 03:38:59 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file