Skip to main content
2 of 3
added 228 characters in body

How do i run multiple functions simultaneously on a LCD screen?

I have little to no experience in programming and i'm very slowly and gradually getting the hang of it. My next project is that i'm making a clock, and wanted to use multiple functions for the hour:minute:seconds instead of just using one for everything. But after reading some i came to the conclusion that the arduino can only run one function at a time. So my question is how can i make the illusion of multiple functions running simultaneously on a LCD screen.

My Minute() function is as follows:

void Minute(){

      int First_Digit = 0;
      int Second_Digit = 0;
  for(Second_Digit; Second_Digit<10; Second_Digit++){
    if(Second_Digit==10){
      First_Digit = First_Digit + 1;
      lcd.print(First_Digit);
      }
    lcd.setCursor(3, 0);
    lcd.print(First_Digit);
    lcd.setCursor(4, 0);
    lcd.print(Second_Digit);
    delay(60000);
    lcd.clear();
    
    if(First_Digit==5 && Second_Digit==9){
      First_Digit = First_Digit - 5;
      Second_Digit = Second_Digit -10;
      lcd.print(First_Digit);
      
      }
    if(Second_Digit==9){
      First_Digit = First_Digit + 1;
      lcd.print(First_Digit);
      Second_Digit = Second_Digit - 10;
      }
    
  }
}

And my Second():

    void Second(){
      int First_Digit = 0;
      int Second_Digit = 0;
    
      for(Second_Digit; Second_Digit<10; Second_Digit++){
        if(Second_Digit==10){
          First_Digit = First_Digit + 1;
          }
          
        lcd.setCursor(0, 0);
        lcd.print(First_Digit);
        lcd.setCursor(1, 0);
        lcd.print(Second_Digit);
        delay(1000);
        lcd.clear();
        
        if(First_Digit==5 && Second_Digit==9){
          First_Digit = First_Digit - 5;
          Second_Digit = Second_Digit -10;
          
          }
        if(Second_Digit==9){
          First_Digit = First_Digit + 1;
          Second_Digit = Second_Digit - 10;
          }
        
      }
    }

And the setup and loop are very simple:

void setup()
{
 lcd.begin(16, 2);
}
  
void loop()
{
  Second();
  Minute();
}

I know i can't use delay() and have no idea how to tackle this another way.