timer example for the NXP freedom platform
Dependencies: mbed
Fork of frdm_timer by
Diff: main.cpp
- Revision:
- 1:15681077dea3
- Parent:
- 0:5e8c7a36cb58
- Child:
- 8:9ebf83f8337e
diff -r 5e8c7a36cb58 -r 15681077dea3 main.cpp --- a/main.cpp Fri Oct 12 13:03:56 2012 +0000 +++ b/main.cpp Fri Oct 12 13:08:38 2012 +0000 @@ -1,21 +1,10 @@ #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 - } + +Timer t; + +int main() { + t.start(); + printf("Hello World!\n"); + t.stop(); + printf("The time taken was %f seconds\n", t.read()); } \ No newline at end of file