CHANGE to trigger the interrupt whenever the pin changes value,
RISING to trigger when the pin goes from low to high,
FALLING for when the pin goes from high to low.
I’ve implemented this on an electron e-series 2G/3G, but no matter what sleep timeout I choose the device wakes up after 2 hours of sleep. The device wakes up correctly if pinged via console.
I’ve also tried to pass 0 seconds (sleep forever?) with same results.
I have WKP connected to an I/O line and I previously used SLEEP_DISABLE_WKP_PIN in different sleep modes to avoid unwanted wake-ups, but it seems this option is not available together with the RI_UC option.
I tried the same procedure on a Electron 2g/3g global (SARA-U260) running deviceOS 1.0.1. The device still wakes up every 2hours. This is my code. Any idea @rickkas7 ? Thanks!
#include "Particle.h"
SerialLogHandler logHandler(LOG_LEVEL_TRACE);
const int SLEEP_PIN = D2;
void setup() {
Serial.begin();
pinMode(SLEEP_PIN, INPUT_PULLUP);
}
void loop() {
if (digitalRead(SLEEP_PIN) == LOW) {
Log.info("turning on AT+URING=1");
// Enable wake on all URCs
Cellular.command("AT+URING=2\r\n");
delay(1000);
System.sleep(RI_UC, RISING, 120, SLEEP_NETWORK_STANDBY);
// This delay is to allow the serial monitor to reconnect only
delay(2000);
Log.info("woke from sleep mode");
// Turn URING back to the default value (only notify on SMS or voice call)
Cellular.command("AT+URING=0\r\n");
}
}