Thread: Wiring a switch
View Single Post
  #2   Spotlight this post!  
Unread 15-02-2005, 22:14
Sparks333's Avatar
Sparks333 Sparks333 is offline
Robotics Engineer
AKA: Dane B.
FRC #1425 (Wilsonville Robotics)
Team Role: Alumni
 
Join Date: Feb 2004
Rookie Year: 2003
Location: Wilsonville, Oregon
Posts: 184
Sparks333 is a glorious beacon of lightSparks333 is a glorious beacon of lightSparks333 is a glorious beacon of lightSparks333 is a glorious beacon of lightSparks333 is a glorious beacon of lightSparks333 is a glorious beacon of light
Send a message via AIM to Sparks333
Re: Wiring a switch

If this is an on/off two position switch, then you wire one side of the switch to the digital i/o ground (black) and the middle pin of the switch to the digital i/o signal (white). Look in software for either a 1 or 0 on that digital port.

If this is more than two positions, then you can do two things: you can wire the black to the middle switch port, and a signal on either side, and use more than one digital port. Or, if you feel, and it's a 3 position switch, you can put +5 on one side, GND on the opposite side, signal in the middle, and wire resistors between each port (I suggest a 50K ohm on each side.) Put that into analog inputs, and you should get 0, 128, and 255. If that was confusing, i can go into more depth, but if this is not your situation, then ignore it.
__________________
ICs do weird things when voltage is run out of spec.

I love to take things apart. The fact that they work better when I put them back together it just a bonus.

http://www.ravenblack.net/random/surreal.html

Last edited by Sparks333 : 15-02-2005 at 22:23.