logoalt Hacker News

em3rgent0rdryesterday at 8:06 PM0 repliesview on HN

It depends. Many modern microcontrollers are perfectly fine driving LEDs directly off IO pins if the pin specs say it is rated for sufficient current (like 20mA). However, older ones like ESP8266 can only do like 2mA and the 8051 even less. Or you run into a total power budget issue if your are running too many pins. Also, some IO pins are perfectly fine at sinking current to ground but aren't suited for sourcing current, in which case the LED would be directly connected to an external high voltage and the IO pin would simply be switching to ground or not.