title: ESP32 external pin wakeup with internal pullup resistor
body: <p>I am very new to working with Arduino and any kind of circuits.</p>
  
  <p>I am trying to set up an ESP32 board to wake up with an external trigger by using the command <code>esp_sleep_enable_ext0_wakeup</code></p>
  
  <pre><code>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();
  }
  </code></pre>
  
  <p>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.</p>
  
  <p>Is there a way to use the internal pull-up resistor for this purpose?</p>
  
  <p>I would appreciate anyone who could explain how this works in general.</p>
  
  <p>The <a href="https://github.com/espressif/arduino-esp32/blob/master/tools/sdk/include/esp32/esp_sleep.h" rel="nofollow noreferrer">documentation</a> says:</p>
  
  <blockquote>
    <p>@note This function does not modify pin configuration. The pin is configured in esp_sleep_start, immediately before entering sleep mode.</p>
  </blockquote>
  
  <p>Maybe I need to configure it correctly with <code>esp_sleep_pd_config</code>. Could that be the reason for the pullup resistor not working?</p>