Using keypad to enroll to Fingerprint sensor

Hello all, I would like to know is it possible to enter the ID number to be enroll by using a keypad? Below is my code .

void keypadEvent(KeypadEvent key){
switch (keypad.getState()){
if (key == ‘#’) {
Serial.println(“Ready to enroll a fingerprint!”);
Serial.println(“Please type in the ID # (from 1 to 127) you want to save this finger as…”);
id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
Serial.print(“Enrolling ID #”);

Under the id=readnumber(); , how do i change it to take value from keypad instead of typing the id number through the serial monitor. I tried to get the value by using id=keypad.getKey() but it does not work as i wanted. Please advise as i’m new to this

Keypad_and_Sensor.ino (5.5 KB)