Circuit
Switch a 12 V LED from a 5 V logic pin
A microcontroller pin gives 5 V and can supply only a few milliamps. It must switch an LED that runs from 12 V through a 470 ฮฉ resistor, about 20 mA. An NPN transistor does it: a small base currentโฆ