The ESP32 has built-in pull-up and pull-down resistors, which can be enabled in software using the pinMode() function. The resistance values for the internal pull-up and pull-down resistors in the ESP32 are approximately 45kΩ. These internal resistors are useful when you need a simple way to ensure a default state (either HIGH or LOW) for a GPIO pin, without needing to add external resistors.
Enabling internal pull-up resistor:
Enabling internal pull-down resistor:
Basic Arduino Code
This example configures GPIO 22 as an input, using the internal pull-up resistor.