Using a simple keypad doesn't work

Hi all,
I'm new here and am a bit lost. I'm using an Arduino Mega, and have wired up a simple keypad matrix using 7 pins. I'm using the simplest code at the top of this post.. https://forum.arduino.cc/t/keypad-data-entry-a-beginners-guide/660309

I've edited the pins to correspond to my board.

It doesn't seem to work at all. I'm getting nothing in the serial monitor.

Does anyone have any idea what I could be doing wrong.

Let's see your code and your schematic. Schematic can be hand drawn, that's fine. Some clear, bright, close-up photos of the circuit might also help.

Have you set the baud rate in serial monitor to match the code?

the code you point to has

const byte ROWS = 4;
const byte COLS = 4;

so you would have 8 pins to wire

are you sure you connected the right pins to your keypad?

Hi,
Here's the code.

#include <Keypad.h>

const int ROW_NUM = 4; //four rows
const int COLUMN_NUM = 3; //three columns

char keys[ROW_NUM][COLUMN_NUM] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};

byte pin_rows[ROW_NUM] = {24,26,28,30};
byte pin_column[COLUMN_NUM] = {25,27,29};

Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );

void setup(){
  Serial.begin(9600);
}

void loop(){ 
  char key = keypad.getKey();

  if (key){
    Serial.println(key);
  }
}

This is the keypad itself.. https://www.ebay.co.uk/itm/364668261936

PIN 27 is wired to Keypad terminal 1
PIN 27 is wired to Keypad terminal 1
PIN 27 is wired to Keypad terminal 1
PIN 27 is wired to Keypad terminal 1

Sorry, prematurely sent that... standby

PIN 27 is wired to Keypad terminal 1
PIN 24 is wired to Keypad terminal 2
PIN 25 is wired to Keypad terminal 3
PIN 30 is wired to Keypad terminal 4
PIN 29 is wired to Keypad terminal 5
PIN 28 is wired to Keypad terminal 6
PIN 26 is wired to Keypad terminal 7

| |PIN||25|27|29|
|PIN| |Col 1|Col 2|Col 3|
|24|Row 1|K3/K2|K1/K2|K5/K2|
|26|Row 2|K3/K7|K1/K7|K5/K7|
|28|Row 3|K3/K6|K1/K6|K5/K6|
|30|Row 4|K3/K4|K1/K4|K5/K4|

that's the expected wiring

it seems yours is not matching that

Knowing that there is variation depending on the keypad, I used an multimeter to test. But yes that picture is correct and marries up with my pins on each of the columns and rows

right I got confused indeed it's matching.

did you solder the wires and check for continuity ?

I sure did. About 20 times. Honestly, it's so frustrating.

Can you get any response leaving the keypad aside? Just carefully use a jumper wire to briefly connect any row pin to any column pin.

Did I miss where you confirm you have the baud rate set to match? Can you print and see stuff on the serial monitor?

a7

Of course! Can't believe I didn't think of this. Yes the baud rate is the same. I'll try this in the morning.