I have a project using a MKR WiFi 1010 with an external interrupt on pin 8 from a PIR sensor to wake it up from low power sleep mode. Then I connect to the WiFi network and issue a push notification through Pushsafer to my iPhone. The MKR 1010 is powered by a 2,500 mAh LiPo battery. I would like to be able to wake up the MKR 1010 using the internal real time clock about every 4 hours, check the battery voltage and issue a push notification if it needs to be charged. That way I wouldn't have to manually check a network of these devices to see if their batteries are in need of charging.
I'm using the Arduino LowPower library sleep() method and putting the WiFiNINA module in low power mode. LowPower.attachInterruptWakeup(8, dummy, RISING) works fine for the PIR interrupt. I tried adding LowPower.sleep(14400). in the main loop but it blocked the PIR interrupt.
I'm guessing that the LowPower.sleep() method takes priority but I can't really tell from looking at the ArduinoLowPower.cpp file in the library. They are not overloading the same method. Does anyone know how I could use these two different interrupts to wake the MKR 1010 up? Attached is my sketch.
ExternalWakeup-ajm2.ino (6.08 KB)