Looking for sleep mode library 32u4 - arduino micro.

Hello. Im looking for working library for sleep modes.

This library work good if arduino go to sleep. But problem is with wakeup - pins which cant work:

D1;D2 (TX;RX) cant work.

Works:
SS ; D8 ; SCK ; D13 If I have used:

ISR(PCINT0_vect)

PCICR = 1;
PCMSK0 = B00000011;

anyway, after wakeUp:

  • USB not working
  • ADC not working,
  • timers not working
#include "LowPower.h"
const int wakeUpPin = 20;

void wakeUp()
{
    // Just a handler for the pin interrupt.
}

void setup()
{
pinMode(wakeUpPin, INPUT);
}


void loop()
{

// Allow wake up pin to trigger interrupt on low.
    attachInterrupt(wakeUpPin, wakeUp, LOW);
    
    // Enter power down state with ADC and BOD module disabled.
    // Wake up when wake up pin is low.
    LowPower.powerDown(SLEEP_FOREVER, ADC_ON, BOD_OFF); 
    
    // Disable external pin interrupt on wake up pin.
    detachInterrupt(wakeUpPin); 

 }

D1;D2 (TX;RX) cant work.

TX/RX is on D0/D1. Why do you think they don't work? They are INT2 and INT3.

SS ; D8 ; SCK ; D13 If I have used:

D13? I have some doubts. The others may work over the pin change interrupt.

    attachInterrupt(wakeUpPin, wakeUp, LOW);

I have also doubts that this work for pin 20 (A2).

anyway, after wakeUp:

  • USB not working
  • ADC not working,
  • timers not working

Using the posted code you cannot know that. If you see such problems you should post code that shows the problems. BTW BOD_OFF works only for pico-power chips (p.e. ATmega328p).