One pin, one light
Each light is its own loop: a signal pin, an LED, a 1 kΩ resistor and GND. The three loops meet only at GND, so the board lights exactly the pins you set HIGH, all three at once included. Keeping a real sequence is the sketch's job.
Three loops that share one wire
Pick which pins are HIGH. Current flows round those loops and no others. Each one runs from your board's pin, through an LED, through that LED's own resistor, into GND and back to your board. The net list has exactly those three paths and nothing else: no part connects one colour to another.
GND is the only wire the three share, so it is the only place their currents add up. The rest of the time they are three copies of the XL LED's circuit side by side. Where the current goes follows one loop in detail.
One resistor each
Each LED has its own 1 kΩ resistor, printed 1001. One resistor for all three, on the shared GND wire, would not work: the lights would share its current, and each one would get dimmer as the others came on. With one each, every light's current depends only on its own pin.
The resistor is what keeps the current safe for your board's pin, and what the resistor is for explains why an LED cannot do that for itself. 1 kΩ is a generous value. It also makes the arithmetic easy: every volt left over after the LED is one milliamp.
Nothing stops all three
A real traffic light's controller is built so that conflicting lights cannot show together. This board has no such thing. It is three LEDs and three resistors, and it will light green with red if both pins are HIGH.
So the sequence lives entirely in your sketch, and a sketch that turns one light on without turning the others off will show two at once. The sketches in this book avoid that by setting all three pins in every step, even the ones that do not change.
When it does not work
Not usefully. Joining two signal pins to one GPIO lights both together, which a traffic light never wants, and the pin then supplies both currents. Give each colour its own pin. The block was built with three for that reason.
It makes no difference. In a single loop the same current flows through every part, so the resistor limits it wherever it sits. On this board each resistor is between its LED's cathode and GND, the same as on the XL LED.
No. A four-character code on a small resistor is three digits and a multiplier: 100 followed by one nought, so 1000 Ω, which is 1 kΩ. All three resistors on the board are the same value.
No. From a 5 V pin the three together draw about 8.5 mA, and each pin supplies only its own light's share, about 3 mA at most. That is far inside what an Uno's or an ESP32's pin may supply, and inside a Pico's default 4 mA per pin.
Four wires and a sketch that proves each one is where you think it is.
The lamp test →Edit this page — content/books/traffic-light/one-pin-one-light.mdx
Questions about this product
See what other owners have asked, and read their solutions.
Traffic Light
Loading discussions…
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.