What should be the best way to connect a led on GPIO pin to work as an indicator but also as GPIO for use in other things. Should I connect it in a serial way? but I think Ill have a voltage divider, or in parallel way?
1 Answer
\$\begingroup\$
\$\endgroup\$
2
Because the microcontroller output is a voltage source, you should connect the other item in parallel with the LED:
simulate this circuit – Schematic created using CircuitLab
Notes:
- The above presumes that you want the LED on when the other load is high. If you want the opposite behavior, flip the diode and connect the anode to the supply voltage.
- Be careful to not exceed the maximum current rating for the pin.
- The pin cannot simultaneously be an input and an output.
-
1\$\begingroup\$ The pin can be an input if the external input can drive the LED and will not drive it in a different direction than the GPIO. Takes some work, but not impossible. \$\endgroup\$ Commented Sep 8, 2015 at 23:12
-
\$\begingroup\$ @WoutervanOoijen Good point, one could add a buffer/transistor if needed. In an inverting configuration of needed. \$\endgroup\$ Commented Sep 9, 2015 at 0:44