Help with 2x2 matrix button board

I haven't, unfortunately I left my multimeter back home from winter break.

I mean, I've only ever used push buttons.
I still don't get why when I press one button, all of them respond

EDIT: Respond as the same button I mean.

funkyguy4000:
I don't get these switches!
They are different, I've never used 2 pin ones.

Did you ever run successfully the sketch that you had copy/pasted off the 'net before you started changing it?

No, there aren't many sketches for just the 2x2 matrix.
I have had it working to the point where it lights up, and then I press a button and all the lights change to the specified, but its always the same color and doesn't correspond to which button is pressed

I still don't get why when I press one button, all of them respond

EDIT: Respond as the same button I mean.

Well, clearly you don't have them connected right. I would expect the switches to be wired one side to ground and one side to a digital pin, with the pullup resistor on that pin enabled. Press the switch to have the pin go LOW.

funkyguy4000:
No, there aren't many sketches for just the 2x2 matrix.
I have had it working to the point where it lights up, and then I press a button and all the lights change to the specified, but its always the same color and doesn't correspond to which button is pressed

Well, it appears you got that code from here http://www.aarongoselin.com/active-posts/28-using-sparkfuns-2x2-rgb-led-button-pad-with-an-arduino
(Not that it's that great as PaulS has noted)

But again, did it work before you started changing it?

Cheers,
John

So I set it up like this?

As I wrote up-thread his version may have the "isolation diodes" in which case he would need to go the other way around, with pulldown resistors...

A good reason to have a multi-meter. OP, hit the nearest Radio Shack (or equivalent) before you fry something.

Haha, okay. I'll get in the lab tomorrow. I need to get to my MATLAB homework anyway.
To make sure we are clear, what exactly am I looking for?

funkyguy4000:
So I set it up like this?

Yeah. Unless you can figure out that your version does not have the isolation diodes, in which case it could be simpler..

And maybe just start with 1 button
get it Working
...
and then 1 led
get it Working
...
and then more leds
working
... etc

Well I could remove the diodes

If you remove the diode and replace with jumper (or better would be 1-to-5k resistor ) , you can do without the external pull-down resistor and wire the switches between the arduino pin and Gnd.

In that case your hardware test code would be simply like this:

// Button sense
const int button1 = A1;  // or whichever you wire to
const int button2 = A2;
const int button3 = A3;
const int button4 = A4;

void setup()
{
	// Button sense
	pinMode(button1, INPUT_PULLUP);
	//pinMode(button2, INPUT_PULLUP);
	//pinMode(button3, INPUT_PULLUP);
	//pinMode(button4, INPUT_PULLUP);
}
void loop()
{
	Serial.print( digitalRead(button1));  Serial.print("\t");
	//Serial.print( digitalRead(button2)); Serial.print("\t");
	//Serial.print( digitalRead(button3)); Serial.print("\t");
	//Serial.print( digitalRead(button4));
	Serial.println();
	delay(250);
}

Shouldn't the input pins be digital and not analog?

And the switches should go from the digital pin to GND when pressed, yes?

MaJiG:
Shouldn't the input pins be digital and not analog?

Any pin (including "analog pin") can be used as digital.

And the switches should go from the digital pin to GND when pressed, yes?

Yes, they are wired with one side to the aruduino pin, and the other side to GND.