blink led2 every 5 seconds.

Dependencies:   mbed

main.cpp

Committer:
wiznxt
Date:
2010-11-12
Revision:
0:4a11c98a6810

File content as of revision 0:4a11c98a6810:

#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);
    }
}