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.

Committer:
stevew817
Date:
Mon Apr 20 14:45:04 2015 +0000
Revision:
0:b0927d62ef70
Child:
3:c950338a014e
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stevew817 0:b0927d62ef70 1 #include "mbed.h"
stevew817 0:b0927d62ef70 2
stevew817 0:b0927d62ef70 3 DigitalOut myled(LED1);
stevew817 0:b0927d62ef70 4 LowPowerTicker toggleTicker;
stevew817 0:b0927d62ef70 5
stevew817 0:b0927d62ef70 6 void ledToggler(void) {
stevew817 0:b0927d62ef70 7 myled = !myled;
stevew817 0:b0927d62ef70 8 }
stevew817 0:b0927d62ef70 9
stevew817 0:b0927d62ef70 10 int main() {
stevew817 0:b0927d62ef70 11 toggleTicker.attach(&ledToggler, 0.2f);
stevew817 0:b0927d62ef70 12 while(1) {
stevew817 0:b0927d62ef70 13 sleep();
stevew817 0:b0927d62ef70 14 }
stevew817 0:b0927d62ef70 15 }