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.
Right
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
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro