All projects

Logic & sequencing

Traffic light

Beginner25 min

Three LEDs, a realistic cycle, and a clean introduction to state machines.

What you get

A junction cycling green, amber and red with correct timings, without blocking the program.

Parts (simulated)

  • Arduino UNO board
  • Red, amber and green LEDs
  • 3 × 220 Ω resistors
  • Breadboard

Nothing to buy: every component here is simulated in the browser.

Project steps

  1. 01Wire the three LEDs with their resistors.
  2. 02Write the simple cycle with delays.
  3. 03Replace blocking waits with the millis() pattern.
  4. 04Restructure it as a readable state machine.

What you learn

  • Multiple digital outputs
  • Non-blocking timing
  • State machines

Other projects