Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

controlling two leds w 1 pin

Status
Not open for further replies.

MrDEB

Well-Known Member
I want to see if it is doable to control two leds with one pic output.
charplexing was first idea but ??
End result is alternately blink the two leds back and forth.
Not real important but for this application it would be better than one led blinking.
my first thought
5v+-----I>-----resistor---pic pin1
grd-----<I-----resistor---pic pin1
then just have the pic pin high / low
not real happy with it but?? pretty basic design.
 
If you want them both on at the same time just toggle them faster then you can see the blink.
 
no have them blink alternately.
Need to end this thread as I finalized my board design and sent the files to Elecrow PCB manfacturing in China
 
alternately blink the two leds back and forth.
Do you mean 1-1-1-1-2-2-2-2-1-1-1-1-2-2-2-2 ..... or 1-2-1-2-1-2-1-2 ..... ?
 
It's simple you set port high led A is on then led B is off you set port Low B is on A is off set port to tr-state both leds are off.

Want both toggle them faster then you can see them blink.
 
that is exactly what I am doing, two leds, two resistors and alternate the port HIGH then LOW
was hoping to go with something a little bit more exotic like only one resistor but went the KISS method.
 
It's simple you set port high led A is on then led B is off you set port Low B is on A is off set port to tr-state both leds are off.

Want both toggle them faster then you can see them blink.


As Burt says, but allow me to put it into termsMrDEB can understand.

HIGH or LOW obviously turns one of the LEDs.

Making the output "tristate" turns both off. For MrDEB, that means setting the port pin to INPUT.
 
he could use one resistor but if the leds don't match one will burn out id just use 2
 
If the port pin is set as an input,

R = 330 + 330 = 660 ohms

Vf = 2.2 + 2.2 = 4.4 volts

Iled = (5 - 4.4)/600 = 0.6/600 × 1000mA/1A = 1mA

Mike is right.


SmartSelectImage_2017-08-30-18-42-26.png
 
I just tried this with a pic18f1220 it don't work one led blinks only did you test this.
This is funny but I tried this with 2 pic16f1825 and 18f1220 they both wouldn't source power
they sink and bink led. OK I figured it out bad resistor out the bag.
It doesn't turn off the leds when set to input. I'm using two 1 k the blink not bad

 
Last edited:
You could have, LED - Diode - Diode - LED and a resistor from the diode junction to pic pin.

Or, use lower voltage supply.

Mike.
 
good point Mike.
I would think the port pin goes LOW then only one LED will light.
Will have to re think as per Burts example or ??
 
You could have, LED - Diode - Diode - LED and a resistor from the diode junction to pic pin.

Or, use lower voltage supply.

Mike.
Like Mike said you can turn one off one on but not both off they light up dim But with the 2 diodes 4 supply they both go off without the diodes the voltage needs to be around 3.2 volts to turn off both. it the way the port pins are made the protection diodes
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top