Limit current with fewer resistors

arduinocurrent-limitingled

Arduino digital pin in OUTPUT mode have low impedance, is it safe to limit current through two leds (connected to two output pins) with one resistor, not two (knowing that leds will go dim and current will decrease when both diodes will be on (I'm not going to turn them on at the same time anyway)). Does led diode protect pin from sinking current (when pin is LOW)?

There's two circuits on simulation, right is right way to limit current, and left is "wrong" way to do it, center switch closes first circuit and opens second and vice versa. Left and right switch changes level of second pin from HIGH to LOW. Resistor near current source simulates low impedance of power source.

simulation
image

Best Answer

As long as you will definitely only power one of the LEDs, it's perfectly fine to share a single resistor between them. If you do ever power both, the current won't be split evenly between them; one is likely to be much brighter than the other because of slight variations in LED forward voltage.