strange issue, button example

using either the Diecimila or Duemilanove 328, when using the Button example, which just turns led 13 on/off when button 2 is pressed. I am getting these problems...

1) with no cables plugged in, just led in 13, when i touch the pin holder row (top right of board) with my finger, the led comes on and stays on for a second.

2) if i plug a cable into slot 2 and dont connect it to anything, the led comes on half brightness then full brightness, then goes off for after a second when you take the cable away.

3) if i plugged a cable into ground, then another into 2, then touch the two together (like a button would) then the led comes on but stays on for maybe 1.5 seconds after i release.

Thanks

I think what you are seeing is a floating input. The state is floating between on/off. If it switches fast enough it won't look like blinking, but just dim.

There is a pull-up resistor on each input, but when you plug in a piece of wire you are attaching an antenna for other signals to overwhelm the pull-up. If you need a bare piece of wire connected, then provide a bigger pull-up.