Trying to wire up 4x4 button pad so it can detect a specific button press

Hi,

I bought this sparkfun 4x4 button pad a while back (Button Pad 4x4 - Breakout PCB - COM-08033 - SparkFun Electronics) and
I’ve been able to get the LEDs to light up using two 74HC595 shift registers so that’s all good. Now, I’m attempting to figure out how to wire up the switch-grounds and switches so that it can detect a specific button press.

I’ve gone back to the very basics and am not using a shift register for these switches. Just trying to get row 1 working for now. I’ve wired up SWITCH1 to a 0.1 uF capacitor and then to analog input 0 on the Arduino. The code works to detect when any of the buttons on the first row is pressed, but I can’t figure out how to wire it so that I can figure out when a specific row and column is pressed…aka I want only the button I press to light up. I have a feeling it has something to do with the switch-ground1 (currently connected to a 10k pull-down resistor and ground), but I’m unsure how to wire that up so it can detect a column key press.

Here’s my code; this will light up row 1 when one of the buttons on row 1 on the 4x4 LED matrix is pressed:

void loop() {
   int readA0 = analogRead(A0);
   
   if ((pastReadA0 + readA0)/2 < 40){        // row 1 button is pressed
     turnOnLED(B01000000, B00000000);
   }
   else{
     turnOffLEDs();
   }

  pastReadA0 = readA0;
}

Any help will be greatly appreciated!

Actually, I just got it working. Turns out I needed to wire up the switch to Vcc (no capacitor needed) and switch ground to the analog input!!! Writing it out helped clarify for me.