Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // Puts MCU to sleep for specified number of seconds using
  2. // WDT to wake every second and track number of seconds
  3. void sleep(uint8_t s)
  4. {
  5.     uint8_t i;
  6.     sleep_interval = 0;
  7.     while (sleep_interval < s) {
  8.         set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  9.         wdt_reset();
  10.         sleep_mode();
  11.     }
  12. }