FeaturesGet started

Blinking an LED with an ESP32 (and Why It Took an Hour)

The hello-world of electronics, plus the mistakes that slowed me down.

Published
November 10, 2026
Read time
1 min
Words
63
Channel
Electronics

Parts

  • ESP32 dev board
  • 1 LED, 1 × 220 Ω resistor
  • Breadboard and jumper wires

Code

const int LED = 2;
 
void setup() {
  pinMode(LED, OUTPUT);
}
 
void loop() {
  digitalWrite(LED, HIGH);
  delay(500);
  digitalWrite(LED, LOW);
  delay(500);
}

What went wrong

The LED was in backwards. LEDs have polarity: the longer leg is the anode (+).