• 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.
 

be80be

Well-Known Member
If you want them both on at the same time just toggle them faster then you can see the blink.
 

MrDEB

Well-Known Member
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
 

alec_t

Well-Known Member
Most Helpful Member
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 ..... ?
 

be80be

Well-Known Member
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.
 

MrDEB

Well-Known Member
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.
 

JonSea

Well-Known Member
Most Helpful Member
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.
 

be80be

Well-Known Member
he could use one resistor but if the leds don't match one will burn out id just use 2
 

JonSea

Well-Known Member
Most Helpful Member
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
 

be80be

Well-Known Member
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:

Pommie

Well-Known Member
Most Helpful Member
You could have, LED - Diode - Diode - LED and a resistor from the diode junction to pic pin.

Or, use lower voltage supply.

Mike.
 

MrDEB

Well-Known Member
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 ??
 

be80be

Well-Known Member
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

EE World Online Articles

Loading
Top