1 year, 5 months ago.


What does LowPowerTimeout stand for ? In the source code, it is a sub-class of LowPowerTicker, which is sub-class of Ticker. Then why mbed have two similiar classes ?

And there are no demo code how to use that. It seems we should add a callback for LowPowerTimeout ?

Comment on this question

1 Answer

1 year, 5 months ago.

A Timeout calls some once function after a specified time interval, while a Ticker will call a function at a recurring interval.

You can view their class references here -

You can use the LowPowerTicker's attach function to specify the callback, the following code example will turn on an LED after 2 seconds:

#include "mbed.h"

DigitalOut led1(LED1);
LowPowerTimeout timeout;
void set_led() {
    led1  = 0;

int main() {
    led1 = 1; // Turn off LED
    // Call set_led after 2 seconds 
    timeout.attach(&set_led, 2);

To post an answer, please log in.