yuki hashimoto
/
InterruptIn
割り込み入力
p5へのGND入力で割り込み発生し,LED4が点滅.
https://mbed.org/users/okini3939/notebook/InterruptIn_jp/
Diff: main.cpp
- Revision:
- 0:8364af11a956
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 23 10:32:15 2014 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" + +InterruptIn button(p5); +DigitalOut led(LED1); +DigitalOut flash(LED4); + + +void flip(){ + led = !led; +} + +int main() { + button.mode(PullUp); + button.fall(&flip); + + while(1) { + flash = !flash; + wait(0.25); + } +}