Closed pomplesiegel closed 1 year ago
nvm, I see this works with the following example:
#include <RTCZero.h>
const byte button = 20; //SDA = PA22
bool ledIsOn = false;
volatile bool shouldBeSleeping = false;
RTCZero rtc;
void setup() {
rtc.begin();
pinMode(button, INPUT_PULLUP);
Serial1.begin(115200);
attachInterrupt(button, interr, LOW);
Serial1.println("== Interrupt test ==");
}
void loop() {
if (shouldBeSleeping) {
Serial1.println("Now going to sleep");
rtc.standbyMode();
}
digitalWrite(LED_BUILTIN, ledIsOn = !ledIsOn);
delay(1000);
}
void interr() {
// Serial1.println("Interruption triggered");
shouldBeSleeping = !shouldBeSleeping;
}
Hello! This is a great library and I have used it with great success on my SAMD21 chip (SAMD21G18A).
Question: Do you think it would be possible to have the device wakeup from its current sleep
standbyMode()
with a button press in addition to the normal RTC-based interval wakeup? I imagine this would mean attaching an interrupt to a behavior of an input pin (likely going from HIGH to LOW), and that triggering a device wakeup as well.What are your thoughts on if / how this could be achieved with the current library?
Thank you! Michael