Topic: Button Halp!
(Read 531 times)
Feb 11, 2011, 01:52 am
I uploaded the Button example, connected the button up to pin 0 and 2. Without touching it the led sometimes will randomly come on, I move it around and it will occasionally stay off and the button will turn the led on and off.
RTFD (Datasheet in our case)
Re: Button Halp!
Feb 11, 2011, 02:13 am
The arduino's input pins are
sensitive. Because of this, they can detect TINY amounts of current floating around in the air: that's your "random" part. We use something called "pull-down resistors" to fix this. Here's how you can use one:
This causes all the random current to go to ground, and the pin sees 0. When you press the button, 5V can travel along the wire, and the pin sees 1.
(Don't worry if you don't understand it, just remember it)
Also: the resistor needn't be exactly 10k--that's just a common value. Any other resistor around that area should work.