I tried to simplify my code. I think I need to do a few things. Maybe make the ScreenTwo= LOW and lcd.clear() stuff a function to clean up everything, or put the millis stuff into the ~~ I feel like something should go here ~~ part.
Helping a novice like me, probably seems grueling, but I really appreciate all your help!
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long ScreenRefresh = 5000;
void loop(){
currentMillis = millis();
if (customKey == '*' ) {
currentMillis = millis();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("The Coop Door Is");
ScreenTwo = HIGH;
~~Feel Like Something Should Go Here ~~
ScreenTwo = LOW;
lcd.clear();
MainMenu();
}
}
if (ScreenTwo == HIGH) //if we are showing screen 2
{
if (currentMillis - startMillis >= ScreenRefresh) //if the period has passed
{
CoopDoor(); //refresh the screen
startMillis = currentMillis; //save the time that it was refreshed
}
}
}
So maybe something like this?
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long ScreenRefresh = 5000;
void loop(){
currentMillis = millis();
if (customKey == '*' ) {
currentMillis = millis();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("The Coop Door Is");
ScreenTwo = HIGH;
}
}
if (ScreenTwo == HIGH) //if we are showing screen 2
{
if (currentMillis - startMillis >= ScreenRefresh) //if the period has passed
{
CoopDoor(); //refresh the screen
startMillis = currentMillis; //save the time that it was refreshed
ClearScreen();
}
}
}
void ClearScreen (){
ScreenTwo = LOW;
lcd.clear();
MainMenu();