Button Halp!

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.

The arduino's input pins are very 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:

5V-----Button------Input Pin
|
|
10k ohms
|
|
|
GND

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.

Good Luck!

baum