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?
Because the microcontroller output is a voltage source, you should connect the other item in parallel with the LED:
- 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.