Need help with my keypad

Dear Arduino users,

today my keypad came shipped in, and guess what, I couldn't get it working!

My keypad came with THREE Pull Up resistors of 10kOhm.
After looking everywhere on the internet I couldnt find any explanation with 3 resistors.
So now I will be asking you guys to give me clear instructions how to wire it up correctly.
I looked at my date sheet but it didn't help me out at all. I got a matrix keypad which for some reason seems to have 9 pins, which 2 of them dont seem to be connected to the actual keypad.

Please help me!


What keypad do you have, can you provide a link?

What keypad do you have, can you provide a link?


I am dutch so you probally wont be able to read it but it says: its a keypad with 0-9 # and *. It has 7 connections with 3 collums and 4 rows. I comes with 3 pull up 10kohm resistors for the collums.

Just as a side note. When I take the pull up resistor, push on end into the ground of the arduino, and push the other end into any ROW it seems to send a number or #/* to my Serial monitor. But when I leave the resistor there and push the button it doesnt return any value? Any clue?

So did you follow the link on that page?

When using the script from the playground nothing works, except for when I start doing stuff with the resistors. when using this code:

 * Keypad Matrix
 * Copyright 2009 by Ilya Brutman <>
 * 8/16/2009
 * Scans a keypad and outputs which button was pressed. Also lights an LED everytime a button is pressed.
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <>

int cols[] = {6,8,4};                                                                //set the pins that are connected to the columns on the keypad (order important)
int rows[] = {7,2,3,5};                                                              //set the pins that are connected to the rows on the keypad  (order important)
char labels[4][3] ={{'1','2','3'},{'4','5','6'},{'7','8','9'},{'*','0','#'}};        //define a label for each button

int ledPin = 13;                                                                     // choose the pin for the LED
char temp;

void setup() {
  Serial.println("ready for action");

  pinMode(ledPin, OUTPUT);          // declare LED as output
  pinMode(cols[0], INPUT);          // declare column 0 pin as input
  pinMode(cols[1], INPUT);          // declare column 1 pin as input
  pinMode(cols[2], INPUT);          // declare column 2 pin as input
  pinMode(rows[0], OUTPUT);         // declare row 0 pin as output
  pinMode(rows[1], OUTPUT);         // declare row 1 pin as output
  pinMode(rows[2], OUTPUT);         // declare row 2 pin as output
  pinMode(rows[3], OUTPUT);         // declare row 3 pin as output

  digitalWrite(rows[0], HIGH);
  digitalWrite(rows[1], HIGH);
  digitalWrite(rows[2], HIGH);
  digitalWrite(rows[3], HIGH);
  digitalWrite(cols[0], HIGH);      //turn on pull up resisitor
  digitalWrite(cols[1], HIGH);      //turn on pull up resisitor
  digitalWrite(cols[2], HIGH);      //turn on pull up resisitor


void loop(){

  temp = getButtonPress();    //check which button is currently pressed

  if (temp > 0){              //if a button is pressed
    Serial.print(temp);       //print it out
    Serial.print(" ");


char getButtonPress(){
  int val = 0;

  for(int j = 0; j<=2; j++){
    for(int i = 0; i<=3; i++){
        digitalWrite(rows[0], HIGH);       //set all the rows to HIGH
        digitalWrite(rows[1], HIGH);
        digitalWrite(rows[2], HIGH);
        digitalWrite(rows[3], HIGH);
        digitalWrite(rows[i], LOW);        //set the current row we are looking at to LOW

        val = digitalRead(cols[j]);        // read state of button at ROW i, Column j

        if (val == HIGH) {                 // check if the input is HIGH  (Button not pressed)
          digitalWrite(ledPin, LOW);       // turn LED OFF
        } else {
          digitalWrite(ledPin, HIGH);      // turn LED ON

              while(val == LOW){               // wait for button to be released
                val = digitalRead(cols[j]);    // read input value

              return(labels[i][j]);        //return the label of the button pressed
    }//for i
  }//for j
  return 0;                        //return 0 if no button was pressed

The serial monitor seems to spit out some random 8’s.

Can someone provide me with clear intructions prefeably using the keypad library and making the keypad with code lik:



Try using the keypad library.

I do use the keypad library but it doesnt seem to be working what ever I do, I am very frustrated. Please let someone have an answer

Show us a picture of your setup.

As of right now I don't have a real setup as I am just trying everything that I find and still nothing works. Sadly I can't seem to find any way to get a descend picture. I made some with my smartphone but I can't find them on my pc. Isn't there a clear tutorial somewhere on the internet?

tutorial somewhere on the internet?