I am very new to working with Arduino and any kind of circuits.
I am trying to set up an ESP32 board to wake up with an external trigger by using the command esp_sleep_enable_ext0_wakeup
void setup(){
int MY_PIN = 13;
pinMode(MY_PIN, INPUT_PULLUP);
int reading = digitalRead(MY_PIN);
if(reading == 1) {
esp_sleep_enable_ext0_wakeup(GPIO_NUM_13,0);
}
else {
esp_sleep_enable_ext0_wakeup(GPIO_NUM_13,1);
}
// I want the board to wake up every time the state of the switch changes.
esp_deep_sleep_start();
}
I run into troubles with this. The wakeup doesn't happen when I expect it to. I assume it has to do with using an external pull-up resistor. I didn't connect one.
Is there a way to use the internal pull-up resistor for this purpose?
I would appreciate anyone who could explain how this works in general.
The documentation says:
@note This function does not modify pin configuration. The pin is configured in esp_sleep_start, immediately before entering sleep mode.
Maybe I need to configure it correctly with esp_sleep_pd_config. Could that be the reason for the pullup resistor not working?