Hello,
I am trying to use ArduinoLowPower.h to save power for stand alone device (with PIR sensor).
My PIR sensor is connected on pin 2 but this code doesn't work, board doesn't want to wake up.
#include "ArduinoLowPower.h"
// Pin used to trigger a wakeup
const int pin = 2;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(pin, INPUT);
// Attach a wakeup interrupt on pin 2, calling alarmLive when the device is woken up
LowPower.attachInterruptWakeup(2, alarmLive, CHANGE);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(LED_BUILTIN, LOW);
LowPower.sleep();
}
void alarmLive() {
digitalWrite(LED_BUILTIN, HIGH);
}
My device is a MKRFox1200.
Thanks for your help!
J-M-L
2
The MKRFOX has 8 External Interrupts on pins 0, 1, 4, 5, 6, 7, 8, A1 (16) and A2 (17)
2 does not seem to be in that list
(This is the French forum here - on cause français
)