Go Down

Topic: Button Halp! (Read 652 times) previous topic - next topic


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

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!


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131