Go Down

Topic: Getting 3x4 Keypad to work with Duemilanove (Read 6643 times) previous topic - next topic

RenRen

So I'm a total nood and I can't find anything on how to connect the keypad   to my arduino, so I can get a servo to run when the right pass code is entered but first i need to figure out how to hook it up. it only has 7 connection points and all the diagrams I can find have 14 of are how to connect it to a diecimila. Can anyone help me please? :-/

PaulS



TchnclFl

From the comments on that item:

Quote
Looking at the top of the board, the pinout from left to right is:
No connection
Column 1
Row 0
Column 0
Row 3
Column 2
Row 2
Row 1
No connection

RenRen

I'm lost as to what any of that means.... sorry I'm a n00b

mstanley

I posted a tutorial for this on the playground.
http://www.arduino.cc/playground/Main/KeypadTutorial

It tells you how to identify your pins/columns/rows and provides an example sketch.  

If you need extra help you'll find my email address at the top of the Keypad.cpp file when you download the keypad library.

-Mark

RenRen

Sadly that does not help me AT ALL, I only have 9 "holes"/connections not 14 or whatever, I can't get it to work, has anyone done this? Pictures? PLEASE?

mstanley

[size=14]Connect a Spark Fun Keypad to an Arduino[/size]




  Keypad            Designator            Arduino
     Pin #                                           Pin #
      1                    Col1                     12
      2                    Row0                   11
      3                    Col0                     10
      4                    Row3                    9
      5                    Col2                      8
      6                    Row2                    7
      7                    Row1                    6

With that information at hand you should connect keypad pin 1 to Arduino pin 12 and so on down the list.  (You can choose different Arduino pins if you prefer.)

If you have the keypad library properly installed then use the HelloKeypad example to test your setup. Follow the menus File->Examples->Keypad->Examples->HelloKeypad to load the sketch.  Using the list of Arduino pin numbers from above change rowPins and colPins to match.  The pins must be entered in order from Row0 to Row3 and Col0 to Col2.

Example:      rowPins[4] = {11, 6, 7, 9};
This means pin 11 = Row0, pin 6 = Row1, pin 7 = Row2 and pin 9 = Row3.  The same is true for colPins.

Mark Stanley

Code: [Select]
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
     {'1','2','3'},
     {'4','5','6'},
     {'7','8','9'},
     {'*','0','#'}
};

byte rowPins[ROWS] = {11, 6, 7, 9}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {10, 12, 8}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
     Serial.begin(9600);
}

void loop(){
     char key = keypad.getKey();
     
     if (key != NO_KEY){
           Serial.println(key);
     }
}


econjack

mstanley:

Beautiful job of explaining things!

Go Up