Arduino Your Home & Environment: Using a 4x4 Keypad by Steve Spence: I was working on a project for someone who needed a keypad for password entry. I couldn't find my 3x4 keypad, but found a 4x4 keypad in one of my parts boxes. I modified the example sketch that comes with the excellent keypad library to work with this particular keypad. I couldn't find a set of extended headers to directly connect the keypad to the Arduino, so I used a small protoboard.
You do need the library from http://playground.arduino.cc/Code/Keypad
I connected all the pins from the keypad, from left to right, to 9-2 on the Arduino. Key output shows in the Serial Monitor. In Part 2 I'll show how to accept and compare passwords.