Answer the question
In order to leave comments, you need to log in
There is an LED. Should the resistor be connected to GND or to 5V?
Is there any difference at all?
5V - LED - resistor - GND
5V - resistor - LED - GND
Answer the question
In order to leave comments, you need to log in
It depends on what logical signal (zero or one) on the GPIO pin of the microcontroller you are going to control the LED. Those. turn on (light) zero or one, you will extinguish the reverse state, respectively.
The main thing is not to reverse the polarity of the LED. The easiest way to determine the polarity is to use a tester (multimeter). Turn it on to ring the diode and connect the probes to the LED terminals. It should light up a bit. If it doesn't light up, swap the probes. Plus and minus can be understood by the colors of the probes. Now, respectively, you can choose to connect "-" to ground (GND) and control a logic one (5 V) from the GPIO port, or connect "+" to 5 V (Vcc) and control logic zero (GND) from that GPIO port. Do not forget about the current limiting resistor so that the GPIO pin does not burn out. The resistance value for 5 V can be calculated by knowing the maximum allowable current for the GPIO output (this information is in the datasheet on the microcontroller) according to Ohm's law.
The resistor is only needed to limit the current. Therefore, the order of its inclusion in the chain is not important.
Typical wiring diagrams here .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question