4×4 Keypad Wiring & Example Code

This example is specifically for the 4 x 4 Matrix Membrane Keypad (#27899) sold by Parallax.

 

Wiring & Connections

 

Quick Code Example

Using the connections shown in the wiring diagram above, this program will show you the number of the key you are pressing on the keypad, in the Terminal, updating once per half-second.

The numbers you see should be very stable. If they fluctuate quickly, or if you notice numbers showing up that you did not press, double-check that you have 1 kOhm (or higher) resistors from pins P7-P4 going to ground and that they’re firmly in the correct breadboard row and ground holes. See connection image, above.