CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Driving a bi-color LED.....

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
John Morley



Joined: 09 Aug 2004
Posts: 97

View user's profile Send private message

Driving a bi-color LED.....
PostPosted: Fri Jan 20, 2006 4:12 pm     Reply with quote

Hi All,

I have a project where I'd like to drive a bi-color LED. The one I'm thinking of has 2 pins (anti-parallel connected LED's). If I hang the LED between 2 digital outputs with a series current limiting resistor, I should be able to turn on one LED by setting one output hi and the other low. The other LED can be turned on by swapping the outputs. I don't see any reason why this won't work. Is there any better way?

Thanks,

John
_________________
John Morley
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Fri Jan 20, 2006 4:46 pm     Reply with quote

Yes it should work, the PIC can source/sink up to 25mA in its outputs. Toggling the
outputs you will get a mix of both colours.
If you want to save one PIC pin, you can connect the bicolor LED to 1/2VCC (2.5V)
and other side to one output + series resistor. You will get 2 colours and the mix of them too.
Downside is that at least one colour always should keep lite on.

Better way ? surelly will be a better way, folks in this forum are plenty of good ideas.

Humberto

Edited for spelling correction only. (is/are)


Last edited by Humberto on Sat Jan 21, 2006 8:13 am; edited 1 time in total
stewart



Joined: 28 Nov 2005
Posts: 12

View user's profile Send private message

PostPosted: Fri Jan 20, 2006 5:21 pm     Reply with quote

To turn the LED off, just set the output bit to an input.

Stewart
Eugeneo



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

PostPosted: Fri Jan 20, 2006 8:16 pm     Reply with quote

Where can you get a cheap 1/2 VCC without using a Voltage divider that is push pull?
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Fri Feb 03, 2006 12:58 am     Reply with quote

I like the voltage divider idea. Even without a voltage divider there would have to be at least one current limiting resistor anyways. For an indicator type LED the current limiting resistor would be on the order of 500ohms, and the total resistance of the divider would be 1000ohms. The leakage would be 5mA, which might be bearable for a wall-powered device.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group