Keypad does not work with fingerprint sensor and arduino

Hi I am doing a project on fingerprint sensing. In this I have to enroll a fingerprint using a fingerprint sensor, a keypad and an arduino UNO. My problem is that the keypad does not get recognized when i connect it with the fingerprint sensor and the arduino. I have attached the codes below.

projectfinal.ino (8.38 KB)

You seem to be using Pin 13 for both your keypad and "button" and Pin 12 for both your keypad and LCD. In general you should not be using a single pin for two different purposes.

Thanks a lot for your help. I have changed the keypad ports. Now the button works fine, but the keypad still does not work. I have attached the modified codes.

projectfinal.ino (8.92 KB)

and just one more thing. Is it necessary to use a keypad event listener in my codes?

and just one more thing. Is it necessary to use a keypad event listener in my codes?

Maybe. Probably.

This line here waits forever until it gets some serial data:

while (! Serial.available());

The program doesn’t do anything else while it’s stuck in this loop. It’s not looking at the keypad or the finger scanner.

And fix your indenting. It’s very difficult to read when the indenting is messed up. I can’t find the matching right-brace that goes with: while (true) {

It’s also very helpful to put a large comment block at the top of the code which describes the purpose of the program and what the program thinks is connected to the Arduino. Look at the examples - they all describe the circuit attached to the Arduino. I also use this comment block to store the modification history of the program, so that I can go back later and understand what I did.

thank you for your help!