Takumi Okamoto
/
InterruptIn_for_arch
SeeeduinoArchで割り込みのテスト
Diff: main.cpp
- Revision:
- 0:af7b276e73a7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 09 02:08:05 2014 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" + +InterruptIn button(P0_23); +DigitalOut led(LED1); +DigitalOut flash(LED4); + +void flip() { + led = !led; +} + +int main() { + button.rise(&flip); // attach the address of the flip function to the rising edge + while(1) { // wait around, interrupts will interrupt this! + flash = !flash; + wait(0.25); + } +} \ No newline at end of file