This supposed to be a normally open switch but when I test it, all contacts are closed and when I press one of the positions, that contact opens. Am I missing something?
The contacts in the 5-position switch are all pulled high. That means when a switch is open it reads 1. When the switch is closed, it reads 0. This is called active LOW, and there are advantages to the approach.
The documentation mentions this (though indirectly), but it's pointed out in the KickStart examples:
If you wire the LEDs from switch outputs to ground, then yes, they'll be lit when the switch is open because the switch outputs are all internally pulled high with 10K resistors. The LED will turn off when you close the switch, because then the output will go low.
The KickStarts serve to flesh out the documentation while keeping things down home and simple, so it's always good to check to see if there's a KickStart for any sensor or accessory you're using. More will be added in the coming weeks, and they'll eventually be moved to the learn.parallax.com site. Both are worthy of bookmarking!
Comments
5 volts to VCC, Pin outputs to LEDs. All LEDs are lit until I set the switch to one of the 5 positions which turns the appropriate LED off.
The documentation mentions this (though indirectly), but it's pointed out in the KickStart examples:
https://sites.google.com/site/parallaxinretailstores/home/parallax-5-position-switch
If you wire the LEDs from switch outputs to ground, then yes, they'll be lit when the switch is open because the switch outputs are all internally pulled high with 10K resistors. The LED will turn off when you close the switch, because then the output will go low.
-- Gordon
-- Gordon