Interrupt using pot value?

the code can be reduced in size by using sprintf() to format a complete c-string with all values to overwrite what it on the display (as well as could be used with Serial.print())

you could conditionally check millis() for an expire period of time before remeasuring or updating the display while outside the condition monitor the pot for changes beyond some delta

here's a quick simulation demonstrating


struct LCD {
    void setCursor (int x, int y)  { };
    void print (const char *s)     { Serial.println (s); };
} lcd;

#define pinPot  A0

void setup ()
{
    Serial.begin (9600);
}

unsigned long msecLst;
unsigned long cycletime;

int           potLst = 0;

void loop ()
{
    unsigned long  msec = millis ();
    const char    *s;

    int potread = analogRead (pinPot);

    if (5 < abs(potread - potLst))  {
        potLst = potread;

        if (potread <= 204) {
            cycletime = 10;
            s         = " 1min";
        }
        else if (potread <= 408) {
            cycletime = 286;
            s         = "30min";
        }
        else if (potread <= 612) {
            cycletime = 573;
            s         = " 1 hr";
        }
        else if (potread <= 816) {
            cycletime = 3438;
            s         = " 6 hr";
        }
        else {
            cycletime = 6875;
             s         = "12 hr";
        }

        lcd.setCursor (11,1);
        lcd.print     (s);

        cycletime *= 10;

        msecLst = msec;
    }

    if ((msec - msecLst) > cycletime)  {
        msecLst = msec;

        Serial.println ("do somthing");
    }
}