Sleep_n0m1 on Nano

Hi, I am trying to use the Sleep_n0m1 library on Nano to put the processor to sleep:

#include <Sleep_n0m1.h>

Sleep sleep;

void setup()
{
    Serial.begin(9600);
}

void loop() 
{
    Serial.println("wake");

    Serial.println("sleep");
    sleep.sleepPinInterrupt (2, FALLING);
    // sleep.pwrDownMode();
    // sleep.sleepDelay(2000);
}

As written, I would expect the processor to go to sleep and never wake up.

However, with sleepPinInterrupt() and pwerDownMode(), the processor never seems to go to sleep, i.e. the there is a constant "sleep ... wake" output on Serial.
SleepDelay() appears to work, i.e. there is a 2 sec delay between "sleep" and "wake" in the output.

Any suggestions, why this doesn't work as expected?
(Note, I am aware of <avr/sleep.h> but am trying to keep it simple ... if possible.)

Thanks !!

For that, maybe your input pin is floating. Use a pull-up or pull-down resistor to give the pin a hard value.

No idea about other one.

I never really resolved this. But I got what I wanted by using <avr/sleep.h>.
Can be closed.

Could you show the code example for future reference?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.