Pages: [1]   Go Down
Author Topic: Trouble with a keypad  (Read 243 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have thoroughly read the other 4x4 keypad related threads in this forum and I'm still having trouble.  I'm using this keypad (http://www.amazon.com/Universial-Switch-Keypad-Keyboard-Arduino/dp/B008A30NW4).  I have the pins hooked up from left to right as 2,3,4,5,7,8,9,10 in the PWM area on an arduino ATMEGA 1280.  The code is as follows:
Code:
#include <Keypad.h>

const byte ROWS=4;
const byte COLS=4;

char KEYS[ROWS][COLS]={
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPINS[ROWS]={2,3,4,5};
byte colPINS[COLS]={7,8,9,10};

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);}
}
I'm not sure what the problem is and every tutorial says the same thing.  I just got the keypad in the mail today.  I'll explore google a little more while I'm waiting, but any help is greatly appreciated.  Thanks in advance.

EDIT: Forgot to mention a big part.  When hooking up to my computer, I open the serial monitor and nothing is displayed when a key is pressed.  I have looked at this thread (http://arduino.cc/forum/index.php/topic,112078.0.html), and near the bottom of the first page, I have seen the wire diagram they advised.  I did try this and the same nothing was what I got.
« Last Edit: February 20, 2013, 05:26:45 pm by Derkatwork » Logged

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

I've got one of those hooked to a Mega 2560 laying right here on the arm of my chair.

The 4 traces on the right are the column pins. The 4 traces on the left are the row pins.

Mine is working perfectly. Double check your wiring is all I can suggest.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm going to try with different wires. I did double check my wiring.  After that, I'll contact amazon and try to return/get a new keypad.  That's all I can think of that's left.  Again, the wires are in the places I stated in the code.  So even if they weren't in the correct spots, I would still get some output (even if it's the wrong one).
Logged

Pages: [1]   Go Up
Jump to: