José Huertas
/
STM32_Button_Interrupt
Nothing
Revision 0:4f766ef79761, committed 2019-10-21
- Comitter:
- Jhp_pce
- Date:
- Mon Oct 21 13:15:37 2019 +0000
- Commit message:
- nothing;
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 4f766ef79761 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 21 13:15:37 2019 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +InterruptIn button(USER_BUTTON); + +DigitalOut led(LED1); + +double delay = 0.5; // 500 ms + +void pressed() +{ + delay = 0.1; // 100 ms +} + +void released() +{ + delay = 0.5; // 500 ms +} + +int main() +{ + // Assign functions to button + button.fall(&pressed); + button.rise(&released); + + while (1) { + led = !led; + wait(delay); + } +}
diff -r 000000000000 -r 4f766ef79761 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 21 13:15:37 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/22da6e220af6 \ No newline at end of file