This is the final step in saving power. It is drastic because it shuts down the CPU and hopes that a peripheral will
wake it back up when there is something to do. In this example code, we shut down the CPU and wake it again when the
INT0 interrupt fires (the INT0 pin goes low). The average current draw is 380µA @ 5V, which is pretty low. At 3.3V the
current drops to 72uA, but if we wake up
and write to an SD card, for instance, the current draw will jump to 13mA for 100mS, then 50mA for 50mS, before it drops back down to the
72µA level again.
Note that these power saving tips won't work directly with Arduino, because Counter/Timer0 is running 1mS interrupts,
and each of those interrupts wakes the CPU. If you disable the Timer0 interrupts, the code will work as expected,
but delays and the millis() function won't work right.
PRR = 0xff;
// Set up a pin for an LED.
DDRB = 0x01;
// Enable the interrupt as a falling edge.
EICRA = (1<<ISC01);
EIMSK = (1<<INT0);
// Go to sleep until interrupted.
// Must enable or can't wake!
// Do stuff like toggle a bit.
PINB |= 0x01;
// Empty. We don't care - we just want it to wake the CPU!