A ticker used to generate a periodic timer interrupt

Dependencies:   mbed

Fork of Timeout_HelloWorld by mbed official

main.cpp

Committer:
mbed_official
Date:
2013-02-15
Revision:
0:8a555873b7d3
Child:
1:04a6abc32fe7
Child:
3:50216cc75b4a

File content as of revision 0:8a555873b7d3:

#include "mbed.h"
 
Timeout flipper;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
 
void flip() {
    led2 = !led2;
}
 
int main() {
    led2 = 1;
    flipper.attach(&flip, 2.0); // setup flipper to call flip after 2 seconds
 
    // spin in a main loop. flipper will interrupt it to call flip
    while(1) {
        led1 = !led1;
        wait(0.2);
    }
}