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

Dependencies:   mbed

main.cpp

Committer:
StefanoArrigoni
Date:
2018-11-09
Revision:
1:e55867cf61fe
Parent:
0:aaf2ecbd9afc

File content as of revision 1:e55867cf61fe:

/****************************************************
*            FAST PROTOTYPING WITH NUCLEO           *
* Example Code 03: Timer                            *
* Author: Mauro D'Angelo                            *
*****************************************************/
/*------------------------------------
* 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;
  }
}