![](/media/cache/group/nucleo401re.jpg.50x50_q85.jpg)
It uses the class timer and call some of the methods it provides
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:aaf2ecbd9afc
- Child:
- 1:e55867cf61fe
diff -r 000000000000 -r aaf2ecbd9afc main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 29 11:27:33 2015 +0000 @@ -0,0 +1,29 @@ +/**************************************************** +* FAST PROTOTYPING WITH NUCLEO * +* Example Code 03: Timer * +* Author: Mauro D'Angelo * +* Organization: Perlatecnica no-profit organization * +*****************************************************/ +/*------------------------------------ +* Hyperterminal configuration +* 9600 bauds, 8-bit data, no parity +*------------------------------------*/ + +#include "mbed.h" + +Timer timer; +Serial pc(USBTX, USBRX); +DigitalOut myled(LED1); + + +int main() { + timer.start(); + int i = 1; + pc.printf("Hello World !\n"); + while(1) { + wait(1); + pc.printf("This program runs since %d seconds.\r\n", timer.read_ms()/1000); + myled = !myled; + } +} + \ No newline at end of file