I need to connect 2 LEDs to a pi3b
Does the image below show the correct wiring or does each led need to connect to ground through a 330 resistor?
he wouldn't be able to use the circuit as shown even in those circumstances. The right hand LED is depicted wired directly to ground, and therefore doesn't have a resistor in its circuit anyway.

Code: Select all
#!/usr/bin/python3
import time
from gpiozero import LED
led01 = LED(16)
led02 = LED(20)
while True:
led01.on()
print ("01")
time.sleep(1)
led01.off()
led02.on()
print ("02")
time.sleep(1)
led02.off()
Code: Select all
#!/usr/bin/python3
import time
from gpiozero import LED
led01 = LED(25)
while True:
led01.on()
time.sleep(1)
led01.off()
time.sleep(1)
Whenever I've tried that, all cathodes commoned through a single resistor to 0V it has worked for me. It's handy for wiring up 7-Segment displays. The only problem is, the more LED's are lit, the dimmer each becomes. That can however be mitigated by varying the duty cycle depending on how many LED's or segments are lit.
Depends on what current they are drawing. Many LED's are super bright these days and only draw a couple of mA with good enough illumination.
This will work OK as long as the 'paralleled' LEDs are more or less identical - specifically as regards their forward voltage drops. This will, of course, generally be true for individual segments of a 7-segment display. However, different colored LEDs typically have somewhat different forward voltage drops, and, if they are connected 'in parallel' with a common resistor, the one with the lowest drop (typically the red one) will be much brighter when both/all are turned on.hippy wrote: ↑Tue Jan 22, 2019 1:18 amWhenever I've tried that, all cathodes commoned through a single resistor to 0V it has worked for me. It's handy for wiring up 7-Segment displays. The only problem is, the more LED's are lit, the dimmer each becomes. That can however be mitigated by varying the duty cycle depending on how many LED's or segments are lit.