TechCircuitGuide
GitHub

Connecting and Blinking an External LED with ESP32

Step-by-step schematic pinout, current-limiting resistor calculations, and verified Arduino C++ verification code.

Hardware Connections

The ESP32 operates at 3.3V logic. Always place a current-limiting resistor (220Ω to 330Ω) in series with the LED to prevent pulling excessive current from the GPIO pin.

Component Pin ESP32 Connection Notes
LED Cathode (-) GND Shorter lead / flat edge of the plastic case
LED Anode (+) 330Ω Resistor → GPIO 23 Longer lead connected via current-limiting resistor

Arduino IDE / C++ Verification Sketch

ESP32_Blink.ino
const int ledPin = 23;

void setup() {
  // Initialize GPIO 23 as an output
  pinMode(ledPin, OUTPUT);
}

void loop() {
  digitalWrite(ledPin, HIGH); // Turn the LED on
  delay(1000);                // Wait 1 second
  digitalWrite(ledPin, LOW);  // Turn the LED off
  delay(1000);                // Wait 1 second
}