Button example question

Hi,

I've had my Arduino for some time now, but unfortunately no time to play with it :/

I was trying to create the circuit with one push-button that is to control the built in LED light. I have a Duemilanove by the way. The problem is that the light blinks when I move my bread board, and not when I push the button :)

In fact, if I take a cable into digital port 2 and just touch the end of it, the light blinks.. Is it supposed to behave like this?

Thanks

I was trying to create the circuit with one push-button that is to control the built in LED light

There's only one circuit to do this? Hard to believe. Some specific circuit you are talking about?

The problem is that the light blinks when I move my bread board, and not when I push the button

If the code sees a button press when you move a wire, the wire is not making a good connection on one end or the other.

If it doesn't react when the button is pressed, the button is not wired correctly, or one or more wires is not making good contact.

In fact, if I take a cable into digital port 2 and just touch the end of it, the light blinks.

If you haven't declared that the pin is an INPUT pin, and used pull-up resistors (internal or external) or pull-down resistors (external), then, yes this is not unexpected behavior. Google "floating pin".

Hi,

I am just trying to recreate the circuit as shown in the Button example: http://arduino.cc/en/Tutorial/Button

The code used is the same as in the example.. Digital pin 2 is set as input. I am using a jumper cable to go from pin 2 to the breadboard. It still blinks if I touch the cable or the breadboard..

Anything else that might be wrong?

Thanks

Anything else that might be wrong?

Yes you haven't wired it up right.

You need to post a photo of what you have before we can be more specific.

Also if you are using the same kind of four terminal switch that the example shows it can be tricky mounting the switch correctly. Only two or the four possible ways to mount the switch will be correct. Try rotating your switch 90 degrees and see if it works then.

Lefty

Also if you are using the same kind of four terminal switch that the example shows it can be tricky mounting the switch correctly. Only two or the four possible ways to mount the switch will be correct. Try rotating your switch 90 degrees and see if it works then.

Lefty

I think this may be the problem. I got it to work once, and that was when I pressed quite hard down on the switch. I tried all orientations. I will try with brand new switches later tonight.

Are there specific brands of breadboards, switches and other gear that work well together, or are all parts standard?

Thanks guys!

Are there specific brands of breadboards, switches and other gear that work well together, or are all parts standard?

They are all standard and in my opinion not very good. The problem is that you don't know if you have made a mistake or the connections are just loose. My preference is to solder things to perforated prototype board or vero board, but then it is a more expensive option as recycling opportunities are limited.