Hi all,
I have commented on a previous thread but it is very old/didn't solve my issue so thought I'd start a new discussion.
I have an Arduino MKRfox1200 which I am trying to use the low power library on to increase battery life. I have followed the tutorial on the low power library on the arduino and have also added a dummy function to try and wake it back up. The board is still not waking up and is staying asleep indefinitely.
The board is also then not recognised on the IDE and you cannot connect to it. I have tried resetting it by pressing the button (holding it down and pressing it twice), but it will not come up on a port.
Any solutions or ideas- likelihood is that I've missed something in my code that would fix it...
#include <RTCZero.h>
#include <ArduinoLowPower.h>
RTCZero rtc;
float alarm_source;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
// Uncomment this function if you wish to attach function dummy when RTC wakes up the chip
LowPower.attachInterruptWakeup(RTC_ALARM_WAKEUP, dummy, CHANGE);
Serial.begin(9600);
rtc.begin();
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
Serial.println("I am awake!");
digitalWrite(LED_BUILTIN, LOW);
delay(500);
Serial.print("Nap time!");
// Triggers a 2000 ms sleep (the device will be woken up only by the registered wakeup sources and by internal RTC)
// The power consumption of the chip will drop consistently
LowPower.sleep(2000);
}
void dummy() {
alarm_source = 0;
// This function will be called once on device wakeup
// You can do some little operations here (like changing variables which will be used in the loop)
// Remember to avoid calling delay() and long running functions since this functions executes in interrupt context
}