Pages: [1]   Go Down
Author Topic: Sleep Tutorial problem  (Read 311 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

« Last Edit: January 13, 2012, 12:15:57 pm by deltacharlie26 » Logged

Offline Offline
Edison Member
*
Karma: 35
Posts: 1419
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
#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
Logged

Where are the Nick Gammons of yesteryear?

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Thanks.
Logged

Pages: [1]   Go Up
Jump to: