What is easy way to extend digital inputs pins using 74hc595+ arduino pro micro

I guess no resistors will be needed because the library will use the Arduino's internal pull-up resistors.

You will need a diode in series with each switch.

If you do not use the diodes, the keypad will appear to work correctly at first. You may not realise there is a problem for some time. But while you play music you may notice some notes being played for which you did not press the key. These are called "ghost key presses" in matrix keypads. The diodes prevent them.

Thank you PaulRB
,......Which value diode??? And. Where??? Means into (button leg & row pin). Or (button leg & colomn pin)???? And also tell direction of diode.. then I will start

I guess any small signal diode should be ok, for example 1N4148. Should be in series with each button, does not matter if column or row side. Direction will depend on your matrix design. If rows have pull-ups and columns are grounded in turn, then diode should allow current to flow from row to column.

this is 1st example in keypad library. i am going to start with it,,,

#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'0','1','2','3'},
  {'4','5','6','7'},
  {'8','9','A','B'},
  {'C','D','E','F'}
};
byte rowPins[ROWS] = {3, 2, 1, 0}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup(){
  Serial.begin(9600);
}
  
void loop(){
  char customKey = customKeypad.getKey();
  
  if (customKey){
    Serial.println(customKey);
  }
}

which thing in this example is telling us that ( If rows have pull-ups and columns are grounded in turn, ) Or
(If column have pull-ups and rows are grounded in turn, )

which thing in this example is telling us that ( If rows have pull-ups and columns are grounded in turn, )

Nothing.

That information is contained in the Keypad.ccp file in the Keypad library.

// Private : Hardware scan
void Keypad::scanKeys() {
	// Re-intialize the row pins. Allows sharing these pins with other hardware.
	for (byte r=0; r<sizeKpd.rows; r++) {
		pin_mode(rowPins[r],INPUT_PULLUP);
	}

	// bitMap stores ALL the keys that are being pressed.
	for (byte c=0; c<sizeKpd.columns; c++) {
		pin_mode(columnPins[c],OUTPUT);
		pin_write(columnPins[c], LOW);	// Begin column pulse output.
		for (byte r=0; r<sizeKpd.rows; r++) {
			bitWrite(bitMap[r], c, !pin_read(rowPins[r]));  // keypress is active low so invert to high.
		}
		// Set pin to high impedance input. Effectively ends column pulse.
		pin_write(columnPins[c],HIGH);
		pin_mode(columnPins[c],INPUT);
	}
}

This is the key part of the library code from here, assuming this is the version you are using. Can you see from the above whether columns or rows are high/grounded? (I can, but I would like you to figure it out. There are only two answers so you have a 50% chance of guessing correctly, but please don't guess, explain why think your answer is correct)

PaulRB:

// Private : Hardware scan

void Keypad::scanKeys() {
// Re-intialize the row pins. Allows sharing these pins with other hardware.
for (byte r=0; r<sizeKpd.rows; r++) {
pin_mode(rowPins[r],INPUT_PULLUP);
}

// bitMap stores ALL the keys that are being pressed.
for (byte c=0; c<sizeKpd.columns; c++) {
	pin_mode(columnPins[c],OUTPUT);
	pin_write(columnPins[c], LOW);	// Begin column pulse output.
	for (byte r=0; r<sizeKpd.rows; r++) {
		bitWrite(bitMap[r], c, !pin_read(rowPins[r]));  // keypress is active low so invert to high.
	}
	// Set pin to high impedance input. Effectively ends column pulse.
	pin_write(columnPins[c],HIGH);
	pin_mode(columnPins[c],INPUT);
}

}



This is the key part of the library code from [here](https://github.com/Chris--A/Keypad/blob/master/src/Keypad.cpp), assuming this is the version you are using. Can you see from the above whether columns or rows are high/grounded? (I can, but I would like you to figure it out. There are only two answers so you have a 50% chance of guessing correctly, but please don't guess, explain why think your answer is correct)

i think there ,,,,, rows have pull-ups and columns are grounded in turn, and diode should allow current to flow from row to column. because i pointed on ,,,,line[pin_mode(rowPins[r],INPUT_PULLUP);] ,,,,,,,
am right ??? and i have a lot of 1N4007 diode ,?? can i use to test????

You are correct about the diode directions. Not sure about suitability of 1n4007 but probably ok. But for prototyping you don't need the diodes. You can add them later