I'm try to make velocity midi keboard by using two keypad, and two keypad have the same row pin, can anyone help me fix this code?

OK. So the code works for 6 piano keys each of which has two tactile button switches.
Now you want to extend it to all piano 61 keys on the Yamaha keyboard.
Q1. Is that correct ?

You have shown this picture.

image

Q2. Is this the Yamaha keyboard ?
Q3. What are the 2 small blue circuit boards connected to the wiring ?

Q4. You have shown pictures of the tactile buttons behind the keys but these pictures appear to have been taken from MIDI keyboard with velocity sensitivity (PASSIVE version) - #10 by petelms . Is your keyboard identical to the one in that thread ?

Q5. Did you get the contents of post #18 from a web search or ChatGPT like tool ?