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

Wire it up
Disconnect power before changing connections. Follow terminal names rather than wire colors.
| From | To | Why it matters |
|---|---|---|
| Uno · 11 | Resistor (r-led11) · 1 | Match this terminal to the sketch |
| Resistor (r-led11) · 2 | LED (led11) · A | Match this terminal to the sketch |
| LED (led11) · C | Uno · GND.1 | Ground reference |
| Uno · 12 | Resistor (r-led12) · 1 | Match this terminal to the sketch |
| Resistor (r-led12) · 2 | LED (led12) · A | Match this terminal to the sketch |
| LED (led12) · C | Uno · GND.1 | Ground reference |
| Uno · 13 | Resistor (r-led13) · 1 | Match this terminal to the sketch |
| Resistor (r-led13) · 2 | LED (led13) · A | Match this terminal to the sketch |
| LED (led13) · C | Uno · GND.1 | Ground reference |
The complete sketch
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
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.
Explore the live circuit
Observe a full cycle and change one phase duration. This is a learning circuit, not a road-safety controller.
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.