Check if the board is in sleep mode

Hi all,

I am testing a sketch that makes the MKR Zero board go to sleep mode and wake up after a few seconds. Does anyone know how can I check if the board is in sleep mode?

Sleepmode.ino (310 Bytes)

If the LED stops blinking, that's a good sign.

Note that there is currently a bug in the ArduinoLowPower library that causes the sleep duration to be 2X what it expected:

Hi Pert,

I want to make my MKR Zero board go to sleep mode to save power and wake up periodically to do something and then go back to sleep until next wake up. I am using RTCZero library now. But the problem is that every time when I upload the sketch to the board, it seems to be upload to the board successfully because the LED blinked as what I wrote in the sketch, but then the Arduino IDE gives an error of "couldn't find the board". I don't know the reason for that.

I think you get that error because the ATSAMD21 chip on your MKR Zero handles the USB of the board, so if the chip is asleep then the USB isn't working.

Try this:

  • Press the reset button on your board quickly twice. You should now see the LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done), which means your sketch that puts the board to sleep isn't running.
  • Select the port of your board from the Tools > Port menu. The port will be different when the bootloader is running so don't assume you already have the correct port selected.
  • Start an upload in the Arduino IDE.
1 Like