please dont rip this site

Hardware Input/Output

1 wire LED and switch

Wagner Lipnharski of UST Research Inc. says:

An easy way to have a key and a indicator led connected to a single microcontroller port pin is connect the LED (anode) with a resistor (330 Ohms) to +VCC (+5Vdc) and the cathode to the port pin, the key goes to the same port pin to ground via another resistor (100 Ohms). By this way, whenever you want to read the key, just flip the port pin to up level and read it. The LED can serve as an indicator of the function selected by the key. Suppose the LED is off (port pin high), pressing the key will turn on the LED (3/4 brighness) and will drop the port pin level, reading the port pin would indicate a low level, so it would means "key pressed", then your software will "latch" that information flipping the port pin to low level (LED goes to 100% brightness) indicating key was read as "pressed". A 49ms low level and 1ms high level to read the key is enough to keep the LED as brigh as possible and run the debounce routine. After the debounce, pressing the key again would signal the software to deactivate the LED. It would works as a flip-flop switch with indicator, with a single port pin. The 100 Ohms resistor (that creates the 3/4 LED intensity) is to inform you when the software effectivelly read the key pressed and confirmed the "pressed" status by bypassing the 100 Ohms resistor to ground.


file: /Techref/io/1wledsw.htm, 1KB, , updated: 2007/6/15 12:11, local time: 2024/5/27 11:48,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> Hardware Input/Output 1 wire LED and switch</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!