New Cortex-M0 mbed caught having a snooze!
Here is the new Cortex-m0 board being sent to sleep, woken up by a button to increment and update a screen, then going back to sleep:
It is running from a couple of AA's, and takes a couple of mA when not doing anything.
Chris hooked this up yesterday for us to test some new sleep() and deepsleep() functions of the mbed C/C++ SDK. The code for this example uses deepsleep(), and looks like:
Simple deepsleep and interrupt wakeup example
#include "mbed.h" #include "TextLCD.h" TextLCD lcd(p21, p23, p24, p25, p26, p27); InterruptIn wakeup(p14); int i = 0; void count() { lcd.locate (0,1); lcd.printf("%d",i); i++; wait(0.5); } int main () { wakeup.rise(NULL); // Setup rising edge interrupt (no handler function needed) lcd.printf("Hello World!"); while (1) { deepsleep(); // Deep sleep until external interrupt count(); // We've come out of sleep due to interrupt, so count! } }
For both sleep() and deepsleep(), all state is retained so you can see it is a nice simple programming model. Should be great for quickly prototyping some things that need to run off batteries.
So all is looking good; hope you'll like it!
For more info on this cortex-m0 board as it goes through beta to release, you can signup to:
16 comments on New Cortex-M0 mbed caught having a snooze!:
You need to log in to post a discussion
Is it 1.5mA supply current including the LCD, or 1.5mA into the processor module only?