Keypad issues

Hi
I'm using the keypad library to run a 4 x 4 keypad. Currently I'm picking up key presses on 3 of my 4 columns just fine. On the fourth column, the Arduino isn't picking anything up. After checking and re checking my wiring and program, I noticed that the three working column pins have a consistent voltage of about 0.5 V. However, the fourth, non functioning pin has a constantly changing voltage anywhere from 0 to a few volts.

Any ideas would be appreciated

The library works. That means that the problem is most likely in your code or your wiring. You didn't post either of those.

Pieter

That's not what I'm suggesting.

My wiring (on Arduino Nano) is column pins to pins 17-20, row pins on 13-16.

Initialisation code:

const byte rows = 3;                        //Keypad Setup
const byte cols = 4; 
char keys[rows][cols] = {
  //{'7','8','9','+'},
  {'4','5','+','-'},
  {'1','2','3','x'},
  {'0','.','=','/'}
};
byte rowPins[rows] = {14, 15, 16}; //connect to the row pinouts of the keypad
byte colPins[cols] = {17, 18, 19, 21}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );

Determining button press code:

char key = keypad.getKey();
if (key != NO_KEY){
if (count == 0) {
switch (key)
{
\continues in switch statement for all possible buttons

Thanks for your help

Also, the keypad is on perfboard, 16 buttons, each wired to specific column/row. I have checked and it is clear of shorts or non connects

macgilligan:
My wiring (on Arduino Nano) is column pins to pins 17-20

byte colPins[cols] = {17, 18, 19, 21}; //connect to the column

Oops?

Do you have a 3 x 4 keypad as your code says, or a 4 x 4 keypad as you claim?

The A6 and A7 pins on a Nano cannot be used for digital IO

Sorry, the code errors are simply left over from some edits I made in order to troubleshoot the problem. Not part of the issue, I just forgot to change them back. It is a 4x4 keypad, just reduced to 3 for the purposes of some different testing.

But UKHeliBob's answer seems to be the solution as it is specifically those pins that are experiencing problems.

Thanks