wiz nxt
/
LED_blink_at_5second_wiznxt
blink led2 every 5 seconds.
Diff: main.cpp
- Revision:
- 0:4a11c98a6810
diff -r 000000000000 -r 4a11c98a6810 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Nov 12 00:39:04 2010 +0000 @@ -0,0 +1,22 @@ +#include "mbed.h" + +Timeout timeout; +DigitalOut led1(LED1); +DigitalOut led2(LED2); +int on = 1; +void attimeout() { + on = 1; + led2 = !led2; +} +int main() { + while (1) { + if (on) { + timeout.attach(&attimeout, 5); + on = 0; + } + led1 = 1; + wait(0.5); + led1 = 0; + wait(0.5); + } +}