Maurizio Conti
/
accell-FRDMKL25
Using on board MMA8451Q on FRK25
Diff: main.cpp
- Revision:
- 0:5e8c7a36cb58
- Child:
- 1:bbb4d2753b6b
diff -r 000000000000 -r 5e8c7a36cb58 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Oct 12 13:03:56 2012 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" + +Ticker tick; +DigitalOut led1(LED_RED); +DigitalOut led2(LED_GREEN); + +void flip() +{ + led2 = !led2; +} + +int main() +{ + tick.attach(&flip, 0.7); // setup ticker to call flip led2 after 0.7 seconds + + // spin in a main loop. + while(1) { + led1 = !led1; + wait (0.3); // flip led1 every 0.3 seconds + } +} \ No newline at end of file