When a light stays dark
Three lights fail in more interesting ways than one. All dark points at GND, one dark points at its own wire or pinMode line, and the wrong colour points at two swapped wires. The lamp test tells them apart in one cycle.
Five symptoms
Pick what the lights are doing. The ringed part of the board is where to look first, and the list beside it is the order to check in. Run the lamp test first: it names each colour as it lights it, so most of these show up in one cycle.
None light
The three lights share only GND, so three failing together is almost always
GND. Then pinMode: a pin never made an output lights faintly or not at all.
Then the cable: shifted one position, the GND wire lands on an NC pin, which
goes nowhere, and no loop is complete. Count from the square pad.
One stays dark
Two lights working proves GND and the block. The dark one is its own wire or
its own line of code. The number in the sketch is the board's GPIO number, not
a position on the header, and each pin needs its own pinMode. Touch that
colour's wire to 3V3 for a moment with GND connected; if it lights, the block
is fine.
The wrong colour
Two signal wires are swapped, or the sketch lists the pins in a different order from the wires. Move the wires to match the sketch, so every sketch in the book works unedited.
Two at once
The block lights whatever pins are HIGH. A step that turns one light on without turning the others off leaves the old one lit too. Every sketch in this book sets all three pins in each step for this reason. The other cause is a pin shared with something else: on an Uno, D0 and D1 are the USB serial line and D13 flashes by itself after a reset.
The green is dim
On a 3.3 V board this is normal: the green gets about 0.6 mA against the others' 1.4 mA, as why the green is different works out. On an Uno all three should look much alike. A green that is dark on an Uno is one of the faults above, not the LED.
When it does not work
Wire GND to your board's GND and touch one colour's pin to your board's 3V3 pin for a moment. That light should come on: its 1 kΩ resistor keeps the current safe even from a supply pin. Try all three. If they light, the block is fine and the problem is the sketch or the wiring.
The six wired to the flash memory, the input-only pins 34 to 39 on a classic ESP32, which cannot drive a light at all, and the strapping pins read at reset. GPIO 25, 26 and 27 are none of those, which is why this book uses them.
Look for a jumper that has come out of the breadboard. The right-angle header pins lie flat and can be pulled out of a row by a wire's weight. Press the block back in, and run the lamp test to check all three.
It is possible but rare, and it is the last thing to suspect. Swap that colour's wire with a working one: if the dark light follows the pin on your board, the problem is the pin or the sketch; if it stays with the LED, it is the block.
The rest of the TinkerBlock blocks, several of which make a good second input for the traffic light.
Back to the blocks →Edit this page — content/books/traffic-light/when-a-light-stays-dark.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.