To get value from keypad

Hello everyone!

I have a question. What syntax do i use to tell the compiler to read the input from a keypad.
For example, we have Serial.available() syntax to read the input from serial monitor. Because in my function i would like to tell the compiler to not run this program until there’s keypad input.

Thanks in advance!

How is the keypad connected to the Arduino?

1 Like

assuming you use the keypad library

this is how you see if a key is pressed

char key = keypad.getKey();
  
  if (key != NO_KEY ){
   // a key was pressed
    Serial.println(key);
  }

so to your question, have at the start of your setup()

void setup() {
  while (keypad.getKey() == NO_KEY); // wait until a key press
  ...
}
1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.