Firmware · GPIO in practice

Driving an LED: source or sink

An LED can be lit by a pin that supplies current or one that sinks it, and the code has to match the wiring.