Ok, so I just got the sparkfun keypad in the mail today:
And am having such a brain fart with it. I don't even know exactly what the issue is. I started out thinking that the generic keypad code @ Arduino Playground - KeypadTutorial would work great. Not so much. I first tried it with my LCD4Bit lib and got a bunch of garbage when pressing a button so I just used the keypad library plus the code on the above playground page but ported it to Serial. No such luck. I'm not getting anywhere yet.
So the next thing I did was run over to SparkFun's site and grabbed the pic of the keypad board and started adding numbers and figuring out what should be the rows and columns. That didn't work either for me. I was a little disappointed that the product wasn't a little friendly in the beginning. Of course, I'm a newbie so maybe its my fault.
Anyway, I would appreciate some help getting this keypad up and running (inc code/where I screwed up).
Here is the code I'm using in Wiring/Arduino:
// An example for testing the matrix keypad driver.
// I don't show an output device but you can use neilzero's
// 4 Bit LCD driver or send characters out the serial port.
// A working example that uses neilzero's LCD driver is
// included in the attached file.
#include <keypad.h>
#define ROWS 4
#define COLS 3
// keypad kpd = keypad() defaults to a 4 by 3 keypad.
// Use ROWS and COLS to match your keypad up to 4x4 keys.
keypad kpd = keypad(ROWS, COLS);
void setup()
{
Serial.begin(9600);
kpd.init();
Serial.println("Ready...");
}
void loop()
{
char key = kpd.get_key();
if(key != '\0')
Serial.print(key);
}
The code above only spits out numbers when #7 and #8 are pressed on the keypad.
#7 spits out 459
#8 spits out 48 (in serial monitor)
Plus a lot of garbage stuck on one number half the time.
Here is the edited library pin settings:
#define COL0 11 // #05
#define COL1 12 // #01
#define COL2 13 // #03
#define COL3 5 // not used as this is a 3 Col x 4 Row keypad
#define ROW0 7 // #02
#define ROW1 8 // #07
#define ROW2 9 // #06
#define ROW3 10 // #04
The #xx above in comment are the pins that the Arduino Digital Pins connect to on the SparkFun keypad. Of course, there are 2 pins (one on each side of the pic at sparkfun) which I do not know whether I should connect or not (I did play with hooking these to 5V/GND with no change).
So here is my question. Is my code screwed up or is this just a pain in the a** because I don't have a matic that defines how the keypad works?
Note: My Arduino board is working fine...tested that. Also tested voltages on a few pins of the keypad and did not get anything higher than 5.7V when pressing/releasing a key.
Arduino is ran off USB (unfortunately Vista PC), latest firm, and Arduino 0010A programmer.
Maybe I'm a dumba** but who makes a component with anything more than a few graphics? Should there not be a PDF with details? Should I have gone with something else through Digi or Mouser?