Submit

02 / 20

Flash two LEDs

Build a crossing signal with two independently wired lights.

Run this experiment →
ESP32 teaching illustration with module, GPIO headers and lesson components

Why it’s here

Change the two phase durations and compare the left and right LEDs.

How it works

Build a crossing signal with two independently wired lights. No. GPIO 2 and GPIO 4 are complementary; the full cycle includes both phases. This guided model targets the original ESP32 and Arduino-ESP32 3.x; radio, acoustics, loads and mechanics are simplified.

Try it

  1. Open this experiment
  2. Change the two phase durations and compare the left and right LEDs.

Connections

  • GPIO 2 / 4 — Separate series resistor → left / right LED
  • GND — Both LED cathodes

Example sketch

void setup() {
  pinMode(2, OUTPUT);
  pinMode(4, OUTPUT);
}

void loop() {
  digitalWrite(2, HIGH); digitalWrite(4, LOW);
  delay(500);
  digitalWrite(2, LOW); digitalWrite(4, HIGH);
  delay(500);
}

Check your understanding

Are both lamps on at the same time?

Show the answer

No. GPIO 2 and GPIO 4 are complementary; the full cycle includes both phases.

Sources

Arduino-ESP32 ↗ · GPIO reference ↗

MAKE A THOUGHTFUL CHOICE

Your shortlist, side by side.

Pricing models are indicative. Check each official website for current plans and limits.