Unable to use free pins with keypad library

I am trying to add the Keypad to my project for threshold entry…The problem I am having is that after wiring my sensors and the LCD, I have the following pins free for use with the keypad:

D7
D10
D13
A1-A7

I am testing on another Nano & breadboard and whenever I wire the 8 pins from the matrix keypad, I can use D7, D10, A1 to A5 but the 8th pin doesn’t work with D13 or A6,A7 …So I am unable to read any input. I’m not sure if it’s the pins not being properly configured or something else:

Here’s the sample code I am using to validate the keypad before I move it into the other project and add other code:

#include <Keypad.h>

const byte ROWS = 4; // Four rows
const byte COLS = 4; // Three columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'#','0','*','D'}
};
// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = { A5, 12,10,7 };
// Connect keypad COL0, COL1 and COL2 to these Arduino pins.
byte colPins[COLS] = { A1,A2, A3, A4 }; 

// Create the Keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

//#define ledpin 13

void setup()
{
  pinMode(13,INPUT);
//  digitalWrite(ledpin, HIGH);
  Serial.begin(9600);
}

void loop()
{
  char key = kpd.getKey();
  if(key)  // Check for a valid key.
  {
    switch (key)
    {
//      case '*':
//        digitalWrite(ledpin, LOW);
//        break;
//      case '#':
//        digitalWrite(ledpin, HIGH);
//        break;
      default:
        Serial.println(key);
    }
  }
}

The Arduino Nano has a led + resistor connected to pin 13, you get into trouble if you use that as input.
The A6 and A7 are not used for a Arduino Uno, but I think they can be used for the Arduino Nano. However, are they only for analog input ! You can't use them as digital pins.

So change two analog signals to be used with A6 and A7. Change an output signal to use pin 13 as output. And you should be able to connect the keypad with the other 'normal' pins.

In your sketch you use pin 12 in 'rowPins', but you write about pin 13.

Thanks, I did eventually find some documentation that A6 and A7 are analong only input pins. I moved my soil sensor to A7 and it worked fine, I was then able to incorporate the keypad into the project.

Now I am battling software issues :smiley: