|
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.
Last edited by Sparks333 : 15-02-2005 at 22:23.
|