Hi, i have a problem with my arduino duemilanove: I made a sketch, but it has problems, then I opened the pushbutton sketch, and when i press the led turns on, but when I relase the led doesn't turn off. I try other pins but it doesn't work. If I "shake" the wire the led turns off, in I remove the wire it remains on. Where it could be the problem?
The input is floating, which means it is neither connected to HIGH or LOW, so it just randomly chooses one. Your capacitance (when you touch the wire, etc.) can make it switch.
You have to attach a pull-down resistor to the input in this example. Read the comments at the top of that example.