MKRWAN 1310 is not waking up

Hello all,

I am trying to use the deepSleep function to put the Arduino MKR 1310 into sleep mode for 2 seconds. It goes to sleep but doesn't wake up. What could be the probable reason? Thank you.

#include "ArduinoLowPower.h"
void setup() {
  Serial.begin(9600);
  while (!Serial) {
    //
  }
}
void loop() {
Serial.println("going to sleep");
LowPower.deepSleep(2000);
Serial.println("woke up");
}

HI ya,

I suspect that wen you deep sleep the serial interface is disabled and not re-enabled afterwards so you can’t see it waking up.

Ou could either do something usb.attach(); before the “woke up“ line, but what would be much easier is that you turn the built in led on and off. I have a little routine that flashes the LED that i call to know the various states.

void blink_led(int ontime=100, int offtime=50, int flashes=1) {
    //todo mattb1969 this function needs to take into account the state of the led on entry, if it is already high, make it low first.
    while (flashes >0) {
        digitalWrite(LED_BUILTIN, HIGH);
        delayMicroseconds(ontime*1000);
        digitalWrite(LED_BUILTIN, LOW);
        if (flashes > 1) delayMicroseconds(offtime*1000);           // If it is not the last flash, wait until returning to the top of the loop
        flashes --;
    }
    return;
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.