The Timer interface is used to create, start, stop and read a timer for measuring small times (between microseconds and seconds).
Any number of Timer objects can be created, and can be started and stopped independently
Hello World!
Simple timer example
#include "mbed.h"
Timer t;
int main() {
t.start();
printf("Hello World!\n");
t.stop();
printf("The time taken was %f seconds\n", t.read());
}
API
API summary
Warning
Note that timers are based on 32-bit int microsecond counters, so can only time up to a maximum of 2^31-1 microseconds i.e. 30 minutes. They are designed for times between microseconds and seconds. For longer times, you should consider the time()/Real time clock.
Last modified 16 Oct 2010, by
Simon Ford

No tags
|
7 comments
Can a future API please add a timer overflow callback? Thanks.