Dependencies: mbed
Revision 0:a3c8e021fd64, committed 2017-01-18
- Comitter:
- florianjehannin
- Date:
- Wed Jan 18 10:22:36 2017 +0000
- Commit message:
- interrupt
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 a3c8e021fd64 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jan 18 10:22:36 2017 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" + +InterruptIn button(PB_13); +DigitalOut led(LED2); + +void flip() { + led = !led; + wait(0.1); +} + +int main() { + button.mode(PullUp); + wait(0.01); + button.fall(&flip); // attach the address of the flip function to the rising edge + led = 0; + while(1) { // wait around, interrupts will interrupt this! + + } +} \ No newline at end of file
diff -r 000000000000 -r a3c8e021fd64 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 18 10:22:36 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file