use of exit(0)

I love this forum. <3

No doubt!

I thought of two caveats with that code...

  1. To truly be "die" the watchdog needs to be disabled. This should do it...
#include <avr/sleep.h>
#include <avr/wdt.h>

void die( void )
{
  wdt_disable();
  set_sleep_mode( SLEEP_MODE_PWR_DOWN );

  while ( true )
  {
    sleep_enable();
    cli();
    sleep_cpu();
  }
}
  1. The output pins will retain their state. Any pins configured OUTPUT / LOW will continue sinking and any pins configured OUTPUT / HIGH will continue sourcing.

I believe everything else will be completely shutdown.