Skip to content

External interruption not being triggered with CHANGE, RISING or FALLING while on standby (sleep) mode. #142

@javorosas

Description

@javorosas

I want to be able to wake up the MKR1000 from an external interrupt. So far I've been trying different configurations and the only interrupt types that work are HIGH and LOW.

So CHANGE, RISING and FALLING are not triggering the external interruption while the board is in sleep mode. Here is my code:

#include <RTCZero.h>

const byte button = 5;
bool ledIsOn = false;
volatile bool shouldBeSleeping = false;

RTCZero rtc;

void setup() {
  rtc.begin();
  pinMode(button, INPUT);
  Serial.begin(115200);
  attachInterrupt(button, interr, RISING);
  Serial.println("== Interrupt test ==");
}

void loop() {
  if (shouldBeSleeping) {
    Serial.println("Now going to sleep");
    rtc.standbyMode();
  }
  digitalWrite(LED_BUILTIN, ledIsOn = !ledIsOn);
  delay(1000);
}

void interr() {
  Serial.println("Interruption triggered");
  if (shouldBeSleeping) {
    Serial.println("This line is never executed");
  }
  shouldBeSleeping = !shouldBeSleeping;
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions