A ticker blinky implementation.

main.cpp

Committer:
sarahmarshy
Date:
2016-09-26
Revision:
0:41a092c2e9d3

File content as of revision 0:41a092c2e9d3:

#include "mbed.h"
 
Ticker flipper;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
 
void flip() {
    led2 = !led2;
}
 
int main() {
    led2 = 1;
    flipper.attach(&flip, 2.0); // call flip function every 2 seconds 


    // spin in a main loop. flipper will interrupt it to call flip
    while(1) {
        led1 = !led1;
        wait(0.2);
    }
}