Sleepy loseSomeTime()
Spend some time doing nothing in the lowest power mode. The amount of time spent is approximate, since the watchdog timer is not very accurate and has a granularity of 16 msec.
Uses the watchdog to get back out of this state, and adjusts the Arduino millis() timer value to account for the lost time.
#include <Ports.h>
#include <RF12.h> // needed to avoid a linker error :(
Sleepy::loseSomeTime(word msec);
Parameters
msec
Number of milliseconds to sleep, in range 0..65535.
Notes
If you use this function, you MUST included a definition of a WDT interrupt handler in your code. The simplest is to include a line with a dummy handler:
EMPTY_INTERRUPT(WDT_vect);
This will get called when the watchdog fires.