Using Keypad.h with a matrix keypad

Looking for suggestions... I want to promt the user to take an action (like select a menu item)
then select the option from a keypad. I'm using the Keypad.h library with a 4x4 matrix keypad.
I send the prompt to the serial device Serial.print("Select desired menu item); I then want
to go into a loop and wait for a keypress i.e. char key = keypad.getKey(); I want the function
to be "blocking". the Keypad.h function getKey() is non-blocking. If I use something
like keypad.waitForKey(); it returns a value of 0x00 when a key is pressed and if I follow
the waitForKey() function with a key = keypad.getKey(); the value of key is null.

Anyone have a structure that will wait for a keypress (blocking) and return the key value
when a key is pressed???

Some code would be nice. Also there is a function called NO_KEY.

Try:

my_key = getkey();
if(my_key != NO_KEY) {
//rest of keypad code here
}

Also there is a function called NO_KEY.

NO_KEY is a constant, not a function.

To block, waiting for a keypress:

while((key = keypad.getKey()) == NO_KEY)
{
   // Do nothing
}

After this block of code, key will contained the key that was pressed.

PaulS:

Also there is a function called NO_KEY.

NO_KEY is a constant, not a function.

To block, waiting for a keypress:

while((key = keypad.getKey()) == NO_KEY)

{
  // Do nothing
}




After this block of code, key will contained the key that was pressed.

I had a brain fart and could not think of the right word to use.

Thanks guys… I had a mind lapse… these were great
suggestions and they worked…!!
XD