It uses the class timer and call some of the methods it provides

Dependencies:   mbed

Committer:
perlatecnica
Date:
Thu Oct 29 11:27:33 2015 +0000
Revision:
0:aaf2ecbd9afc
Child:
1:e55867cf61fe
v1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
perlatecnica 0:aaf2ecbd9afc 1 /****************************************************
perlatecnica 0:aaf2ecbd9afc 2 * FAST PROTOTYPING WITH NUCLEO *
perlatecnica 0:aaf2ecbd9afc 3 * Example Code 03: Timer *
perlatecnica 0:aaf2ecbd9afc 4 * Author: Mauro D'Angelo *
perlatecnica 0:aaf2ecbd9afc 5 * Organization: Perlatecnica no-profit organization *
perlatecnica 0:aaf2ecbd9afc 6 *****************************************************/
perlatecnica 0:aaf2ecbd9afc 7 /*------------------------------------
perlatecnica 0:aaf2ecbd9afc 8 * Hyperterminal configuration
perlatecnica 0:aaf2ecbd9afc 9 * 9600 bauds, 8-bit data, no parity
perlatecnica 0:aaf2ecbd9afc 10 *------------------------------------*/
perlatecnica 0:aaf2ecbd9afc 11
perlatecnica 0:aaf2ecbd9afc 12 #include "mbed.h"
perlatecnica 0:aaf2ecbd9afc 13
perlatecnica 0:aaf2ecbd9afc 14 Timer timer;
perlatecnica 0:aaf2ecbd9afc 15 Serial pc(USBTX, USBRX);
perlatecnica 0:aaf2ecbd9afc 16 DigitalOut myled(LED1);
perlatecnica 0:aaf2ecbd9afc 17
perlatecnica 0:aaf2ecbd9afc 18
perlatecnica 0:aaf2ecbd9afc 19 int main() {
perlatecnica 0:aaf2ecbd9afc 20 timer.start();
perlatecnica 0:aaf2ecbd9afc 21 int i = 1;
perlatecnica 0:aaf2ecbd9afc 22 pc.printf("Hello World !\n");
perlatecnica 0:aaf2ecbd9afc 23 while(1) {
perlatecnica 0:aaf2ecbd9afc 24 wait(1);
perlatecnica 0:aaf2ecbd9afc 25 pc.printf("This program runs since %d seconds.\r\n", timer.read_ms()/1000);
perlatecnica 0:aaf2ecbd9afc 26 myled = !myled;
perlatecnica 0:aaf2ecbd9afc 27 }
perlatecnica 0:aaf2ecbd9afc 28 }
perlatecnica 0:aaf2ecbd9afc 29