LCD is not working according to the code

I want to give lane clearance requested through RF module switch 2 when a correct passcode is entered...
But my lcd is not displaying what I want to display if there is no delay provided..

//////////////////////////////////////////AMBULANCE COMING AT SECOND LANE//////////////////////////////////////////////////////////////////////
if((S11E==1) & (S12E==0)  & (S13E==1) & (S14E==1))
{aa=1;
// Initialize LCD and print
lcd.clear();
lcd.setCursor(0,0);
lcd.print("LANE 2 CLEARANCE");
lcd.setCursor(0,1);
lcd.print("Requested ");
delay(3000);

lcd.clear();
lcd.setCursor(0,0);
lcd.print("Enter Passcode ");


  // Look for keypress
customKey = customKeypad.getKey();
  if (customKey) {
    // Enter keypress into array and increment counter
    Data[data_count] = customKey;
    lcd.setCursor(data_count, 1);
    lcd.print(Data[data_count]);
    data_count++;
  }

  // See if we have reached the password length
  if (data_count == Password_Length - 1) {
    lcd.clear();
 
    if (!strcmp(Data, Master)) {
      // Password is correct
    lcd.clear();  lcd.print("Correct"); delay(1000);
lcd.cursor(); lcd.setCursor(0,0);lcd.print("SECOND LANE PASS");
digitalWrite(L2R, LOW);digitalWrite(L2G, HIGH);digitalWrite(L1R, HIGH);digitalWrite(L3R, HIGH);digitalWrite(L4R, HIGH); //digitalWrite(L2A, HIGH);
  L2[0] = CRGB::Red; FastLED.setBrightness(64 );
  FastLED.show(); 
  delay(200);
  L2[0] = CRGB::Blue; 
  FastLED.show(); 
  delay(200);
/*  L2[0] = CRGB::Yellow; 
  FastLED.show(); 
  delay(200);*/
  digitalWrite(L2G, LOW);//digitalWrite(L2A, LOW);
 L2[0] = CRGB::Black; 
        FastLED.show(); 
}
else {
      // Password is incorrect
      lcd.print("Incorrect");
      delay(1000);
    }
 
    // Clear data and LCD display
    lcd.clear();
   
  }
}

I want to display LANE 2 CLEARANCE REQUESTED then wait for 3 seconds and then display enter passcode and wait until user inputs passcode ....

The LCD is only diplaying LANE 2 CLEARANCE REQUESTED and not movinf forward to display the next line 'Enter passcode'.

Please help solve my problem.

What am I doing wrong?

For debugging purposes: if you would put a "delay(1000)" after "Enter passcode", what happens? My guess is that you should see the "Enter passcode" line... meaning that somehow one of your "if's" or your "else" gets triggered and thus it reaches a "lcd.clear()" command.

By the way, it is my understanding that lcd.clear() brings back the cursor tot position (0.0), so you might erase a few lines for cleaner code?

If I use delay 1000 after 'Enter Passcode' it first shows the LANE 2 CLEARANCE REQUESTED for 3sec and then 'Enter Passcode' for 1 sec...It just go on it doesn't wait until I enter the passcode...

ramesh4nani:
If I use delay 1000 after 'Enter Passcode' it first shows the LANE 2 CLEARANCE REQUESTED for 3sec and then 'Enter Passcode' for 1 sec...It just go on it doesn't wait until I enter the passcode...

It helps if you output debugging lines to the serial monitor. For example, output the customKey to the serial monitor, output a 'Going to clear the LCD at the end...' - statement to the serialmonitor right before that last clear-statement... In that way you can narrow down where in your if's/else's some comparison goes wrong