LCD Important

Hi, I'm new to this site, I'm 17, I'm Italian and I'm working on a project for school. My problem is that the LCD does not make me get out of the DO-WHILE loop. If I delete the DELAY, I am out of the loop but to update the sensor values, I must continually press the KEY 'A' because I planned a switch that can be controlled from a keyboard. Here's the code:

char key = keypad.getKey(); if(key) // Check for a valid key. { switch (key) { case 'A':

do{ for (int u=0; u<=50; u++) { lcd.clear(); lcd.setCursor(0,0); lcd.print("Temperatura 00"); lcd.setCursor(15,0); lcd.print("C");

//GAS lcd.setCursor(0,1); lcd.print("Gas "); lcd.setCursor(5,1); SensoreGas = analogRead(A8); lcd.print(SensoreGas); delay(1000); // QUESTO E' IL DELAY CHE HO CITATO POCO FA }

}while(key!='A');

break;

You don't get a new key value in the do..while loop.

Please remember to use code tags when posting code.