read multiple buttons

How do I have to wire 4 Buttons, so that each button can be read separately with a digital I/O pin.
I’ve tried to use the pull up/down resistor method, but that only works when using one button…

So to clarify, do you mean you want to read 4 buttons on the same one digital pin?

If so, no, you can't do it. What you CAN do though is use ONE analog input pin.

Lucky, this has been recently discussed in this thread just the other day...

I meant how to wire up 4 switches, so that I can read on Pin 2, 3, 4 and 5 a High or Low if the associated button is pressed. So if I push button 1, pin 2 should read High, if i press button 2, pin 3 should read High, etc...

Even easier then.

Just repeat the pull up/down resistor configuration for each button.

Then read up on the internal pull ups to learn how to do it without needing to use an external resistor

If you already tried with the correct pull up / down resistor setup, and it doesen't work, it is most likely your code that has a problem.

If you keep having problems, try to post you code here.

I’m using the Arduino+Firmata patch, to communicate to vvvv. So I think that the patch should be bug free.

Ok, maybe theres a logic error. I have 4 Buttons with 2 pins each. I've connected pin 1 of each button through a resistor with +5V. Then Pin 2 of every button with GND. Pin 1 of each button is also connected to the Digita I/O it belongs to (button 1 to digital IO 2 / button 2 to digital IO 3 / etc...) It seems to me, that each button needs its own power supply. Can someone please upload a picture of how to connect the buttons? I'm really having a problem here.

What you describe will work. You either have not got what you describe or your code is faulty. Can you post the bit of the code that deals with the push buttons.

You can get the Arduino VVVV Firmata Code Here:

But I'm quite shure its not the code. I can read a signal from every pin, but only as long as I use only one button.

And as matter of fact. I have never a scetch or a photo of an Arduino Project using more than one Button...

I think this is where you are going wrong.

When something doesn't work you strip it down to it's basics. First you write your own sketch to read four buttons and make sure it works. That checks out the hardware. Do that first please.

Then you try and integrate the software to it. I looked at the link you sent and can't see what you downloaded and how you made it know you had extra push buttons and how those buttons were connected to the Arduino. In other words you will have to change something in the vvv tool kit to make it work. What are you changing?

I downloaded the arduino Firmata Patch:

All it basically does, transform the Information from the Arduino programming language to VVVV

I would be surprised if this code works because:-

for(i=0; i<TOTAL_DIGITAL_PINS; ++i) {
setPinMode(i,INPUT); } }

Is setting ALL the pins to be inputs. That includes pins 0 and 1 which are the lines used for serial communications. Therefore running this will stop it communicating.

Therefore change the second line to read:-
for(i=2; i<TOTAL_DIGITAL_PINS; ++i) {
And that will bypass the screwing up of the serial port pins.

You are connecting each switch wit a pullUP resistor to +5V is that what the Firmata expects ? sometimes pullDOWN to ground is used.

Also one other possible issue: if your pusbuttons are NC (normally Closed) instead of NO (Normally Open) you could have problems.

The fact that it works with one switch does not make the above suggestions very likely though :-)

How big are the pullup resistors you are using ?

Do you have anything else hooked up to the Arduino board ?

The one button was a DIFFERENT code example.

I used a generic little button for my project, the code is in one of my Arduino posts on

The buttons I used were these:

Ok this is a long shot - be prepared :-)

.On the button you have to use the right combination of pins.

They are connected in two pairs are you by accident using them wrong ?

Ok Ok .......

Oh you mean he might be using the ones that are connected! Yeah notice you have to go diagonally across those types of buttons, the ones on the left/right are connected.

Even though this topic is 11 months old I would like to reply because I think you might have had a mix-up in your wiring. At least I did and ended up here on this topic. I thought using one 10K resistor is enough, before I drew my own schematic about what I had done. Once I did draw it, I discovered that I had linked all the buttons to all the pins.