getKey() Function running during specific times

Hi, I am having issues with programming. I am new to this and have searched high and low for an answer to this. I believe this to be a very simple fix, but I cannot find a solution.

void loop() {
  lcd.setCursor(0,1);
    
  magnetSensor = digitalRead(sensorPin);

  if (magnetSensor == HIGH && armed == 1 && delayBEEP != 1){
    delayTrip();
    
    }
  
  
  keypad.getKey();
}

What I'd like to accomplish: have the keypad keystrokes recognized while delayTrip is running. I've tried playing around with while & Do-While loops to try to remedy this, but I was unsuccessful at figuring it out.

If you need more code posts or anything, let me know.

Hi ethicaldesign

Can you post your complete program. Need to see what delayTrip does.

Regards

Ray

void delayTrip() {
  digitalWrite(pinSpeaker, HIGH);
  delay(350);
  digitalWrite(pinSpeaker, LOW);
  delay(350);
  digitalWrite(pinSpeaker, HIGH);
  delay(350);
  digitalWrite(pinSpeaker, LOW);
  delay(350);
  lcd.clear();
  lcd.print("15 SEC TO DISARM");
  delay(10000);
  alarmActive();
}  
void alarmActive() {
  
  digitalWrite(pinSpeaker, LOW);
  lcd.clear();
  lcd.print("FIVE");
  digitalWrite(pinSpeaker, HIGH);
  delay(1000);
  digitalWrite(pinSpeaker, LOW);
  lcd.clear();
  lcd.print("FOUR");
  digitalWrite(pinSpeaker, HIGH);
  delay(1000);
  digitalWrite(pinSpeaker, LOW);
  lcd.clear();
  lcd.print("THREE");
  digitalWrite(pinSpeaker, HIGH);
  delay(1000);
  digitalWrite(pinSpeaker, LOW);
  lcd.clear();
  lcd.print("TWO");
  digitalWrite(pinSpeaker, HIGH);
  delay(1000);
  digitalWrite(pinSpeaker, LOW);
  lcd.clear();
  lcd.print("ONE");
  digitalWrite(pinSpeaker, HIGH);
  delay(1000);
  digitalWrite(pinSpeaker, LOW);
  lcd.clear();
  lcd.print("ZERO");
  digitalWrite(pinSpeaker, HIGH);
  delay(1000);
  digitalWrite(pinSpeaker, LOW);
  lcd.clear();
  lcd.print("ALARM ACTIVATED");
  digitalWrite(pinSpeaker, HIGH);
  delay(2500);
  lcd.clear();
  lcd.print("NOTIFYING POLICE...");
  delayBEEP = 1;
}

So the loop tells the code to run through both of those, but it does not perform keypad.getkey() until it finishes both of these. I'd like it to take user input while these are running.

  delayTrip();

How we possibly know what delayTrip() is ? You haven't posted your definitions.

What I'd like to accomplish: have the keypad keystrokes recognized while delayTrip is running.

The short answer is no because you didn't use the "millis" function. http://arduino.cc/en/Reference/millis

Thanks for your response! How would I incorporate the millis() function to keep the keypad persistent?

How would I incorporate the millis() function to keep the keypad persistent?

First, read and understand the blink without delay example. Second, embrace the concept that it illustrates. That involves discard the sketch you have and completely starting over.\

Third, getkey() returns a value. Your call discards that value of whatever key, if any, is being pressed when the function is called, so, you are wasting effort even calling it.