Rob Toulson / Mbed 2 deprecated PE_09-03_SimpleTimer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* Program Example 9.3: A simple Timer example, from mbed web site. 
00002 Activate Tera Term terminal to test.           
00003                                                                        */ 
00004 #include "mbed.h"
00005 Timer t;                                              // define Timer with name “t”
00006 Serial pc(USBTX, USBRX);
00007 
00008 int main() {
00009   t.start();                                    //start the timer
00010   pc.printf("Hello World!\n");
00011   t.stop();                                     //stop the timer              
00012   pc.printf("The time taken was %f seconds\n", t.read());  //print to pc
00013 }
00014