Low-powered blinky example

Dependencies:   mbed

Blinks an LED using a low-power ticker.

Uses the asynchronous APIs and improved sleep API.

Information

All examples in this repo are considered EXPERIMENTAL QUALITY, meaning this code has been created as one-off proof-of-concept and is suitable as a demonstration for experimental purposes only. This code will not be regularly maintained by Silicon Labs and there is no guarantee that these projects will work across all environments, SDK versions and hardware.

main.cpp

Committer:
stevew817
Date:
2015-04-20
Revision:
0:b0927d62ef70
Child:
3:c950338a014e

File content as of revision 0:b0927d62ef70:

#include "mbed.h"
 
DigitalOut myled(LED1);
LowPowerTicker toggleTicker;

void ledToggler(void) {
    myled = !myled;
}
 
int main() {
    toggleTicker.attach(&ledToggler, 0.2f);
    while(1) {
        sleep();
    }
}