4X4 Matrix keypad help

Right now, I'm just trying to get my key pad to work. http://www.parallax.com/Portals/0/Downloads/docs/prod/hardware/27899-4x4matrixmembranekeypad-v1.2.pdf That is the data sheet to it. I'm trying to do like the data sheet says, pulling columns high one at a time and reading the rows, but it doesn't seem to be working. I have some buttons reading high all the time (1, *, D, 5, and 8), and A won't register at all. Others, when pressed, send all of the readings into spazzes, oscillating between 0 and 1. Please take a look and see if you can see any obvious errors please.

int orange = 13; // colors correspond to the colors on the data sheet
int green = 12;
int purple = 11;
int blue = 10;
int yellow = 9;
int red = 8;
int lightblue = 7;
int pink = 6;
int key1 = 0;    // the keys
int key2 = 0;
int key3 = 0;
int key4 = 0;
int key5 = 0;
int key6 = 0;
int key7 = 0;
int key8 = 0;
int key9 = 0;
int key0 = 0;
int keyA = 0;
int keyB = 0;
int keyC = 0;
int keyD = 0;
int keystr = 0;  // this is *
int keylb = 0;   // this is #

void setup(){
  Serial.begin(9600);       // printing to LCD screen to see status's
  Serial.print(12, BYTE);
  Serial.print(17, BYTE);
  Serial.print(24, BYTE);
  Serial.print(128, BYTE);
  Serial.print("A= ");
  Serial.print(132, BYTE);
  Serial.print("B= ");
  Serial.print(136, BYTE);
  Serial.print("C= ");
  Serial.print(140, BYTE);
  Serial.print("D= ");
  Serial.print(144, BYTE);
  Serial.print("*= ");
  Serial.print(148, BYTE);
  Serial.print("#= ");
  Serial.print(152, BYTE);
  Serial.print("1= ");
  Serial.print(156, BYTE);
  Serial.print("2= ");
  Serial.print(160, BYTE);
  Serial.print("3= ");
  Serial.print(164, BYTE);
  Serial.print("4= ");
  Serial.print(168, BYTE);
  Serial.print("5= ");
  Serial.print(172, BYTE);
  Serial.print("6= ");
  Serial.print(176, BYTE);
  Serial.print("7= ");
  Serial.print(180, BYTE);
  Serial.print("8= ");
  Serial.print(184, BYTE);
  Serial.print("9= ");
  Serial.print(188, BYTE);
  Serial.print("0= ");
  digitalWrite(yellow, LOW);    // I did this to see if it'd keep pins from starting HIGH
  digitalWrite(red, LOW);
  digitalWrite(lightblue, LOW);
  digitalWrite(pink, LOW);
  pinMode(orange,INPUT);        // Setting rows to inputs
  pinMode(green,INPUT);
  pinMode(purple,INPUT);
  pinMode(blue,INPUT);
}

void loop(){
  digitalWrite(pink, HIGH);     //Sending 1st column high
  keyA = digitalRead(orange);   //Reading rows
  keyB = digitalRead(green);
  keyC = digitalRead(purple);
  keyD = digitalRead(blue);
  if(digitalRead(orange)==HIGH){    //changing key status's based off readings
    keyA = 1;
  }
  if(digitalRead(green)==HIGH){
    keyB = 1;
  }
  if(digitalRead(purple)==HIGH){
    keyC = 1;
  }
  if(digitalRead(blue)==HIGH){
    keyD = 1;
  }
  digitalWrite(pink, LOW);        //Sending 1st column back LOW 
  digitalWrite(lightblue, HIGH);  //Sending 2nd column HIGH
  keyB = digitalRead(orange);     //Reading rows
  key6 = digitalRead(green);
  key5 = digitalRead(purple);
  key4 = digitalRead(blue);
  if(digitalRead(orange)==HIGH){  //Changing key status's based off row readings
    keyB = 1;
  }
  if(digitalRead(green)==HIGH){
    key6 = 1;
  }
  if(digitalRead(purple)==HIGH){
    key5 = 1;
  }
  if(digitalRead(blue)==HIGH){
    key4 = 1;
  }
  digitalWrite(lightblue, LOW);   //Sending 2nd column low
  digitalWrite(red, HIGH);        //Sending 3rd column HIGH
  keyC = digitalRead(orange);     //Reading rows
  key9 = digitalRead(green);
  key8 = digitalRead(purple);
  key7 = digitalRead(blue);
  if(digitalRead(orange)==HIGH){  //Changing key status's based off readings of rows
    keyC = 1;
  }
  if(digitalRead(green)==HIGH){
    key9 = 1;
  }
  if(digitalRead(purple)==HIGH){
    key8 = 1;
  }
  if(digitalRead(blue)==HIGH){
    key7 = 1;
  }
  digitalWrite(red, LOW);         //Sending 3rd column low
  digitalWrite(yellow, HIGH);     //Sending 4th column HIGH
  keyD = digitalRead(orange);     //Reading rows
  keylb = digitalRead(green);
  key0 = digitalRead(purple);
  keystr = digitalRead(blue);
  if(digitalRead(orange)==HIGH){  //Changing status's based off row readigns
    keyD = 1;
  }
  if(digitalRead(green)==HIGH){
    keylb = 1;
  }
  if(digitalRead(purple)==HIGH){
    key0 = 1;
  }
  if(digitalRead(blue)==HIGH){
    keystr = 1;
  }
  digitalWrite(yellow, LOW);      //Sending 4th column low

  Serial.print(130, BYTE);     //Printing results
  Serial.print(keyA);
  Serial.print(134, BYTE);
  Serial.print(keyB);
  Serial.print(138, BYTE);
  Serial.print(keyC);
  Serial.print(142, BYTE);
  Serial.print(keyD);
  Serial.print(146, BYTE);
  Serial.print(keystr);
  Serial.print(150, BYTE);
  Serial.print(keylb);
  Serial.print(154, BYTE);
  Serial.print(key1);
  Serial.print(158, BYTE);
  Serial.print(key2);
  Serial.print(162, BYTE);
  Serial.print(key3);
  Serial.print(166, BYTE);
  Serial.print(key4);
  Serial.print(170, BYTE);
  Serial.print(key5);
  Serial.print(174, BYTE);
  Serial.print(key6);
  Serial.print(178, BYTE);
  Serial.print(key7);
  Serial.print(182, BYTE);
  Serial.print(key8);
  Serial.print(186, BYTE);
  Serial.print(key9);
  Serial.print(190, BYTE);
  Serial.print(key0);   
}

How have you got it wired up? Especially the inputs, have you got the pull down or pull up resistors on them?

No resistors on the outputs. I’ve tried 1k resistors on the inputs, but that didn’t change anything, so right now I have them off. The data sheet showed wiring for the BASIC Stamp and the Propeller, but I didn’t know which would pertain to the Arduino. I’m guessing they need to be in there, so I’ll put them back, but I still have the same problems.

I'm trying to do like the data sheet says, pulling columns high one at a time and reading the rows,

So you need pull down resistors on all the input pins.

Others, when pressed, send all of the readings into spazzes, oscillating between 0 and 1.

That is because the input pins are floating, never a good idea. http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

And I mean pull down resistors not the series resistors shown in figure 2 in the data sheet.

Ahhhh. Thanks. I put those in. The only thing is, in the picture in that link, they show 3k resistors. All I have are 220, 470, 1k, and 10k. I just used 1k resistors, will that do? Because now, none of my buttons are registering. They all show 0 and don’t oscillate, but they won’t change when pressed either. Could that be because of too low of pull down resistors? Thanks for the help.

No 1K is enough. This means that reading will give you a logic zero unless it is pressed and one of the outputs is high.

I can't see you setting any of the pins to outputs in the setup()

Awesome! That was it! I'm going to have to go find my professor from last year that told me that pins are defaultly set to outputs! Thanks a lot!