api / mbed / trunk / Timer
Timer
class Timer : public Base
A general purpose timer
Example
// Count the time to toggle a LED
#include "mbed.h"
Timer timer;
DigitalOut led(LED1);
int begin, end;
int main() {
timer.start();
begin = timer.read_us();
led = !led;
end = timer.read_us();
printf("Toggle the led takes %d us", end - begin);
}A general purpose timer
class Timer : public Base
Start the timer
void start()
Stop the timer
void stop()
Reset the timer to 0.
void reset()
Get the time passed in seconds
float read()
Get the time passed in mili-seconds
int read_ms()
Get the time passed in micro-seconds
int read_us()
