Multiple button problem

Hi,

I have a problem with trying to set up multiple buttons. I followed this tutorial for 1 button and it worked perfectly:

The problem is that I have connected two more in the same way, whereby they are both connected to the same power and same ground, but different digital pins. The pins are 3, 4 and 5.

My problem is that when I press, say 3, both 4 and 5 are reading as if they have been pressed. This works for any combination - i.e. they are acting as if they are one giant button.

What do you think this could be? I hope this is not to vague. If this is the wrong way to do it, what should I think about?

Thanks,
Lee.

What do you think this could be?

You have wired it up wrong. Please post a schematic so we can tell exactly how wrong you are.

Thanks,

Schematic:
http://www.lazeestudent.com/IMAG0018.png

Note the squiggle is a 10Kohm resistor. And the lines to 4 and 5 should be the same 3, I just drew them on the wrong leg of each button

These are the switches I bought:
http://www.maplin.co.uk/Module.aspx?ModuleNo=4196

Use a separate pulldown resistor for each button. The way you have it wired now, the side of the switches connected to the digital pins are all common, so when you close one switch all three digital pins are brought high (through that closed switch).

To see this problem on the schematic, re-draw it with the first switch closed. You can trace with your finger the current path from +5v to any of the three digital pins, so all three digital pins will see +5v.

I see, thanks very much that has been bugging me all day!

Take a look to this webpage, maybe it is what you was looking for:

Good luck!

Thanks for the help. That's also useful. I'm glad to say I have it working now :smiley: