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);
}