Go Down

Topic: Sleep Tutorial problem (Read 387 times) previous topic - next topic

deltacharlie26

Jan 13, 2012, 06:11 pm Last Edit: Jan 13, 2012, 06:15 pm by deltacharlie26 Reason: 1
Hi,
ref http://www.arduino.cc/playground/Learning/ArduinoSleepCode

I can't get the sleep code tutorial to work using 1.0. Works fine on V23, anybody any idea how to get the sleep mode to work, apart from using V23?

Any help appreciated.


el_supremo

Can't remember where I found this, but works for me with V1.0 on a Duemilanove.

Code: [Select]

#include <avr/sleep.h>      // powerdown library
.
.
.

//***************************************************
// *  Name:        enterSleep
  /* the sleep modes
   SLEEP_MODE_IDLE - the least power savings
   SLEEP_MODE_ADC
   SLEEP_MODE_PWR_SAVE
   SLEEP_MODE_STANDBY
   SLEEP_MODE_PWR_DOWN - the most power savings
   */
void enterSleep()
{
      set_sleep_mode(SLEEP_MODE_PWR_DOWN);
      cli();
      sleep_enable();
      sei();
      sleep_cpu();
      sleep_disable();
}


Pete

deltacharlie26

Scratch that. Finger trouble my end. Had a dodgy pos volts on Pin2 not holding the interrupt off.

Thanks.

Go Up