Pages: [1]   Go Down
Author Topic: Getting 3x4 Keypad to work with Duemilanove  (Read 6188 times)
0 Members and 1 Guest are viewing this topic.
Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino N00b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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? :-/
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 642
Posts: 50365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which keypad do you have?
Logged

Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino N00b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.sparkfun.com/commerce/product_info.php?products_id=8653
« Last Edit: November 24, 2009, 06:54:17 pm by gradof6b » Logged

B0100111001000011, USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1503
I'm confused.  Wait, maybe not..
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino N00b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Arduino N00b
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Phillipsburg, NJ
Offline Offline
Full Member
***
Karma: 6
Posts: 184
Author: Matrix Keypad Library
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

[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:
#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);
      }
}
Logged

Cincinnati, OH
Offline Offline
God Member
*****
Karma: 49
Posts: 877
I'm not bossy...I just know what you should be doing.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

mstanley:

Beautiful job of explaining things!
Logged

Pages: [1]   Go Up
Jump to: