June 29, 2008
about 2 years ago
Mine does not work that way. The LED pin and the (+) pin are connected only when the switch is ON. Perhaps yours is defective?
These are a bit annoying to wire up correctly. As Member #246694 notes, there are only 3 pins but the pin with the ground symbol is not the common pin – it is only connected to the LED. The pin with the plus on it and the LED pin are connected together when the switch is closed.
This means that if you want to control the LED and check the switch position independently, you need to wire it up like this:
Also add a 10K ohm pull-down resistor between the input pin and ground on the Arduino. The Arduino’s internal resistors are pull-up and that won’t work here so we need to do this manually.
Now to turn the LED on, set the output pin LOW (so current flows from +5V through the LED and to this output pin). To turn it off, set the output pin HIGH (so current cannot go anywhere). Yes, that feels backwards.
The input pin will be HIGH when closed (as it is connected to 5V), and LOW when open.
No public wish lists :(
Forgot your password?
No account? Register one!