Skip to content

ESP32 GPIO Output Pin Not Changing State

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about ESP32 GPIO Output Pin Not Changing State. We cover key concepts, practical examples, and best practices.

The Problem

ESP32 GPIO configured as output does not change state when written HIGH or LOW.

Quick Fix

Wrong

pinMode(5, OUTPUT);
digitalWrite(5, HIGH);  // No effect
Pin 5 stays LOW regardless of digitalWrite calls.
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);
// GPIO 2 is the built-in LED on most ESP32 dev boards
LED turns on for 1 second, then turns off.
(Voltage on GPIO 2 measures 3.3V HIGH, 0V LOW)

Prevention

Use GPIO 2 for built-in LED testing. Check pin number against board schematic. Some GPIOs have pull-up/down resistors that affect state. GPIOs 6-11 are connected to flash memory and should not be used. Use digitalWrite() after pinMode().

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### Which GPIOs are safe to use as output?

GPIOs 2, 4, 5, 12-19, 21-23, 25-27, 32-33 are safe. Avoid GPIOs 6-11 (flash), 1 (UART TX), 3 (UART RX).

Why does my GPIO stay LOW?

Check for pinMode() typo, conflicting peripheral (I2C/SPI on same pin), or incorrect pin number. Some boards label GPIO numbers differently.

What is the maximum output current?

ESP32 GPIO max output current is 40 mA per pin, with a total of 200 mA across all pins. Use a transistor for higher loads.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro