Argon not waking on gpio

Banging my head against a wall trying to get an Argon to wake from sleep on falling pin…

int PIN_LED = D2;
int PIN_PIR = D8;

void setup() {

    pinMode(PIN_LED, OUTPUT);
    pinMode(PIN_PIR, INPUT);

}

void loop() {

    if(digitalRead(PIN_PIR) == LOW) { // upon PIR trigger
        
        digitalWrite(PIN_LED, HIGH); // turn light on
        delay(1000);
        while (digitalRead(PIN_PIR) == LOW); 
        digitalWrite(PIN_LED, LOW); // turn light off
        
        SystemSleepConfiguration config;
        config.mode(SystemSleepMode::ULTRA_LOW_POWER).gpio(PIN_PIR, FALLING);
        System.sleep(config);
        
    }
 
}

If I wave hand in front of the PIR sensor, the led turns on (as expected) and the Argon goes to sleep (as expected). Problem is that it never wakes up again. I’ve read the System.sleep documentation multiple times. Consider this a cry for help.

Nevermind: the pull up/down resistor applied to pin wake was tripping me up. For reference using “CHANGE” instead of “FALLING” did the trick.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.