I'm getting started with Arduino, and having some trouble working with the pushbutton. My goal is to substitute a switch that I bought at an electronics store for the pushbutton bundled in the kit.
I do get the sample pushbutton sketch to work on the breadboard using the example DigitalReadSerial sketch as described here: http://arduino.cc/en/Tutorial/DigitalReadSerial (10KOhms pull-down resistor I believe)
But when I remove the pushbutton to substitute an action switch, the serial monitor values become erratic, and in fact seem to trigger "1" simply when my hand approaches the breadboard. I then loosely wire in the switch (Philmore Mini Snap Action Switch with Long Lever) into the breadboard, running 2 jumper wires from former the locations of the pushbutton (which I removed) to "COM" and "NO" on the switch. The result: I read "0" as expected when the switch is not pressed, then "1" when I press it. But the values remain "1" when I release, I think because the presence of my hand is triggering it. When I remove my hand, after 4-5 seconds, the values settle back to "0".
I think I'm not understanding a basic principle, maybe related to "pull down", but I would have thought that simply substituting a switch for the pushbutton and leaving the rest of the setup intact would be reliable. What am I missing? Thanks for any tips and suggested reference pages.