I have a simple code for esp32 here. I can only use gpio pin number 35 on the board. So esp32 should go to light sleep and wake up on button press. When I run this program below, my esp32 goes into light sleep, but it doesn't wake up when the button is pressed. What's the problem? Any idea please? Thank you.
#include <esp_sleep.h>
void setup() {
Serial.begin(115200);
delay(2000);
gpio_wakeup_enable(GPIO_NUM_35, GPIO_INTR_HIGH_LEVEL);
esp_sleep_enable_gpio_wakeup();
delay(2000);
Serial.println("Going to sleep now");
delay(2000);
esp_light_sleep_start();
delay(2000);
Serial.println("This will be NOT printed");
}
void loop() {
delay(2000);
Serial.println("Hi after wake up via GPIO Button!");
delay(2000);
}
I've figured out by myself what the trouble was: just change to rtc_io ext0 and set level on 0. Then it will work fine. (Maybe this will be helpful for other users.)