View Single Post
  #2   Spotlight this post!  
Unread 22-02-2009, 16:35
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,998
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Wiring Lightswitch and LED (Driver Station

Connect the switch to one digital input port. Use the value of that port to switch the values of two digital output ports, which drive the LEDs.

If the value of the switch is 1, turn on digital output 1. If the value of the switch is 0, turn on digital output 2. The LEDs must have a resistor in series, use 680 Ohms or 470 Ohms. Connect the + side of the LED to +5 volts, connect the - side of the LED through the resistor to the digital output (which will act as a ground when switched on). (It is better to use the digital output as a ground than to supply power to the LED in this case)

One other way is to use a double-pole double-throw switch. One pole (side) of the switch is for the digital input and wired like the top diagram, the other side is used for the LEDs and has +5 on the center terminal through a 470/680 Ohm resistor, the outside terminals on the switch have one LED each, the + side, and the other side of each LED connected to ground. This approach doesn't need any programming, but is harder to debug.

Don
__________________

I am N2IRZ - What's your callsign?