arduino / arduino/ArduinoCore-samd

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

Open
#142 19 comments 0 reactions 1 assignee Claimed by @agdl View on GitHub
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

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:

``` C++
#include

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;
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.