Go Down

Topic: Button Halp! (Read 533 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

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview