Skip to content

Traffic Light

Sequence three separately wired LEDs through red, green, and yellow phases.

Traffic Light: the matching Arduino Uno circuit rendered in Circuitera’s simulator
Matching Circuitera simulator circuit. Real firmware capture; modeled components are idealized.

Wire it up

Disconnect power before changing connections. Follow terminal names rather than wire colors.

FromToWhy it matters
Uno · 11Resistor (r-led11) · 1Match this terminal to the sketch
Resistor (r-led11) · 2LED (led11) · AMatch this terminal to the sketch
LED (led11) · CUno · GND.1Ground reference
Uno · 12Resistor (r-led12) · 1Match this terminal to the sketch
Resistor (r-led12) · 2LED (led12) · AMatch this terminal to the sketch
LED (led12) · CUno · GND.1Ground reference
Uno · 13Resistor (r-led13) · 1Match this terminal to the sketch
Resistor (r-led13) · 2LED (led13) · AMatch this terminal to the sketch
LED (led13) · CUno · GND.1Ground reference

The complete sketch

traffic-light.ino
const int red = 11, yellow = 12, green = 13;
void setup() {
  pinMode(red, OUTPUT); pinMode(yellow, OUTPUT); pinMode(green, OUTPUT);
}
void loop() {
  digitalWrite(red, HIGH); delay(2000); digitalWrite(red, LOW);
  digitalWrite(green, HIGH); delay(2000); digitalWrite(green, LOW);
  digitalWrite(yellow, HIGH); delay(700); digitalWrite(yellow, LOW);
}

The launch buttons use this same code and a matching saved circuit.

Build it step by step

  1. Open a complete project

    Launch in Simulator creates a separate Uno sketch and its matching wired circuit. Existing sketches are preserved. Press Run to compile and execute.

  2. Explore the live circuit

    Observe a full cycle and change one phase duration. This is a learning circuit, not a road-safety controller.

  3. Try it on hardware

    Disconnect power while wiring. Match terminal names in the table, select the exact board, Verify, then connect and upload. Check component ratings and power requirements first.

Understand the sketch

Independent outputs

Each LED has its own resistor and GPIO. Only one output is high at a time; delay makes this simple sequence blocking.

If something is different

Wrong color order

Compare red D11, yellow D12, and green D13 with the sketch constants.

Expected output and tested scope

The separately wired LEDs progress through the programmed red, green and yellow phases.

Version 1 · Last source- and build-matched test: 2026-10-25. Actual shipped AVR-GCC WASM compilation and Uno AVR engine execution; no physical hardware test.

Supported tutorial target: Arduino Uno R3 / ATmega328P. Compile: PASS · Modeled execution: PASS. Other boards require a separate review of pins, voltage, libraries and the exact build profile.

Keep exploring.