Sodaq One stand-by mode interrupt

Is there any documentation or tutorial on using the Sodaq One in stand-by mode? I’ve tried using the documentation for the MIBLI but nothing seems to work.

My latest code uses the Low-Power library. The code works fine and the interrupt is triggered when I press the button but as soon as the board goes in stand-by mode it doesn’t seem to work anymore.

Do I perhaps need a external button/energy source to trigger the interrupt pin? Is triggering the interrupt possible with the button already present on the board?

#include "LowPower.h"

// External interrupt pin
const int pin = 19;
unsigned char count = 3;

void setup()
{
  // Wait for serial USB port to open
  while (!SerialUSB);
  SerialUSB.println("***** ATSAMD21 Standby Mode Example *****");

  // ***** IMPORTANT *****
  // Delay is required to allow the USB interface to be active during
  // sketch upload process
  SerialUSB.println("Entering standby mode in:");
  for (count; count > 0; count--)
  {
    SerialUSB.print(count);
    SerialUSB.println(" s");
    delay(1000);
  }
  // *********************

  // External interrupt on pin (example: press of an active low button)
  // A pullup resistor is used to hold the signal high when no button press
  attachInterrupt(pin, blink, CHANGE);
}

void loop()
{
  SerialUSB.println("Entering standby mode.");
  SerialUSB.println("Apply low signal to wake the processor.");
  SerialUSB.println("Zzzz...");
  // Detach USB interface
  USBDevice.detach();
  // Enter standby mode
  LowPower.standby();
  // Attach USB interface
  USBDevice.attach();
  // Wait for serial USB port to open
  while (!SerialUSB);
  // Serial USB is blazing fast, you might miss the messages
  delay(1000);
  SerialUSB.println("Awake!");
  SerialUSB.println("Send any character to enter standby mode again");
  // Wait for user response
  while (!SerialUSB.available());
  while (SerialUSB.available() > 0)
  {
    SerialUSB.read();
  }
}

void blink(void)
{
  SerialUSB.println("Awake!");
}

I have some examples available here:

These were originally written for use with the Autonomo but there shouldn’t be any compatibility issues other than the odd IO pin which might need to be changed.

1 Like