user77654: I was wondering, by the time I press the following key, it does not return to the main_screen() function. How can I fix my code?
void loop()
  { 
    int exit = 0;
    char input = customKeypad.getKey();
    
    main_screen();
     if (input=='A')
        { 
          delay(100);
          lcd.clear();
         
          do{
   
           lcd.setCursor(1,0);
           lcd.print("Enter minutes: ");
   
   
             if (input=='B')
               {
                break;
                lcd.clear();
               }
           }
           while(1);
       }

}

user76048: You need to read the input again after you get input == 'A'.  At the moment, when you enter the do ... while loop, the input is always 'A', so input == 'B' is never true, and the loop never exits.

77654: <p>I was wondering, by the time I press the following key, it does not return to the main_screen() function. How can I fix my code?</p>
<pre><code>void loop()
  { 
    int exit = 0;
    char input = customKeypad.getKey();
    
    main_screen();
     if (input=='A')
        { 
          delay(100);
          lcd.clear();
         
          do{
   
           lcd.setCursor(1,0);
           lcd.print(&quot;Enter minutes: &quot;);
   
   
             if (input=='B')
               {
                break;
                lcd.clear();
               }
           }
           while(1);
       }
</code></pre>
<p>}</p>
 76048: <p>You need to read the input again after you get <code>input == 'A'</code>.  At the moment, when you enter the <code>do ... while</code> loop, the input is always 'A', so <code>input == 'B'</code> is never true, and the loop never exits.</p>
