I’m trying to make my Photon enter low power mode and when a button is pressed it wakes up. I have the following code:
int buttonInput = D2;
int led = D7;
void setup() {
pinMode(led, OUTPUT);
pinMode(buttonInput, INPUT_PULLDOWN);
}
void loop() {
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
System.sleep(buttonInput, CHANGE);
}
The button works (tested the interrupt example).
However this does not work, the Photon is sleeping forever. What is the problem?