Zhengguo Sheng / Mbed 2 deprecated serial_timer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* Program: A simple Timer
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 int main() {
00008 t.start(); //start the timer
00009 pc.printf("Hello World!\n");
00010 t.stop(); //stop the timer
00011 pc.printf("The time taken was %f seconds\n", t.read()); //print to pc
00012 }