How to Stop LCD refresh flash from loop

I have combined a few sections of code, it works for my purpose, being able to adjust pot, to give a millisecond time readout.

With the pot value that i have mapped and displaced on LCD 16x2 I2c board.

But given i have it constantly in the loop it has the refresh flash after delay time.

Is there any way that I can set a constant image on screen without the annoying flash happening?

Any thoughts welcome, Thankyou

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int counter = 0;


const int Potentiometer_pin = A1;
int value = 0;

byte LT[8] =
{
  B00111,
  B01111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};
byte UB[8] =
{
  B11111,
  B11111,
  B11111,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000
};
byte RT[8] =
{
  B11100,
  B11110,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};
byte LL[8] =
{
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B01111,
  B00111
};
byte LB[8] =
{
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B11111,
  B11111,
  B11111
};
byte LR[8] =
{
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11110,
  B11100
};
byte MB[8] =
{
  B11111,
  B11111,
  B11111,
  B00000,
  B00000,
  B00000,
  B11111,
  B11111
};
byte block[8] =
{
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};



void setup()
{
  Serial.begin(9600);
  lcd.begin();                      // initialize the lcd
  lcd.createChar(0, LT);
  lcd.createChar(1, UB);
  lcd.createChar(2, RT);
  lcd.createChar(3, LL);
  lcd.createChar(4, LB);
  lcd.createChar(5, LR);
  lcd.createChar(6, MB);
  lcd.createChar(7, block);
  // Print a message to the LCD.
  lcd.backlight();
  int temp = 10;
  lcd.clear();
  printDigits(0, 0);
  printDigits(1, 4);
  printDigits(2, 8);
  printDigits(3, 12);
  printDigits(4, 16);

}



void printNumber(int val) {
  int col = 5;
  if ( val >= 10) {
    printDigits(val / 100, col); //first digit
    printDigits(((val % 100) / 10), col + 4); //middle digit
    //printDigits(val % 10, col + 8); // working last digit
    printDigits(val * 0, col + 8);// removing last digit to display whole number
  }
  else {
    printDigits(val, col);
  }
}


void loop()
{
  Serial.println(value);
  value = analogRead(Potentiometer_pin);            // reads the value of the potentiometer (value between 0 and 1023)
  value = map(value, 0, 1023, 0, 999);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("TIME:");
  printNumber( value );
  delay(500);
}



void custom0(int x) {
  lcd.setCursor(x, 0);
  lcd.write((byte)0);
  lcd.write(1);
  lcd.write(2);
  lcd.setCursor(x, 1);
  lcd.write(3);
  lcd.write(4);
  lcd.write(5);
}
void custom1(int x) {
  lcd.setCursor(x, 0);
  lcd.write(1);
  lcd.write(2);
  lcd.print(" ");
  lcd.setCursor(x, 1);
  lcd.write(4);
  lcd.write(7);
  lcd.write(4);
}
void custom2(int x) {
  lcd.setCursor(x, 0);
  lcd.write(6);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 1);
  lcd.write(3);
  lcd.write(4);
  lcd.write(4);
}
void custom3(int x) {
  lcd.setCursor(x, 0);
  lcd.write(6);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 1);
  lcd.write(4);
  lcd.write(4);
  lcd.write(5);
}
void custom4(int x) {
  lcd.setCursor(x, 0);
  lcd.write(3);
  lcd.write(4);
  lcd.write(7);
  lcd.setCursor(x, 1);
  lcd.print(" ");
  lcd.print(" ");
  lcd.write(7);
}
void custom5(int x) {
  lcd.setCursor(x, 0);
  lcd.write(3);
  lcd.write(6);
  lcd.write(6);
  lcd.setCursor(x, 1);
  lcd.write(4);
  lcd.write(4);
  lcd.write(5);
}
void custom6(int x) {
  lcd.setCursor(x, 0);
  lcd.write((byte)0);
  lcd.write(6);
  lcd.write(6);
  lcd.setCursor(x, 1);
  lcd.write(3);
  lcd.write(4);
  lcd.write(5);
}
void custom7(int x) {
  lcd.setCursor(x, 0);
  lcd.write(1);
  lcd.write(1);
  lcd.write(2);
  lcd.setCursor(x, 1);
  lcd.print(" ");
  lcd.print(" ");
  lcd.write(7);
}
void custom8(int x) {
  lcd.setCursor(x, 0);
  lcd.write((byte)0);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 1);
  lcd.write(3);
  lcd.write(4);
  lcd.write(5);
}
void custom9(int x) {
  lcd.setCursor(x, 0);
  lcd.write((byte)0);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 1);
  lcd.print(" ");
  lcd.print(" ");
  lcd.write(7);
}
void printDigits(int digits, int x) {
  // utility function for display: prints preceding colon and leading 0
  switch (digits) {
    case 0:
      custom0(x);
      break;
    case 1:
      custom1(x);
      break;
    case 2:
      custom2(x);
      break;
    case 3:
      custom3(x);
      break;
    case 4:
      custom4(x);
      break;
    case 5:
      custom5(x);
      break;
    case 6:
      custom6(x);
      break;
    case 7:
      custom7(x);
      break;
    case 8:
      custom8(x);
      break;
    case 9:
      custom9(x);
      break;
  }
}

Maybe stop calling lcd.clear() every time through loop()?

oh wow is it that simple
bugger me
ok thanks will give it a try
feel so stupid ;(

Although this code…

 if ( val >= 10) {
    printDigits(val / 100, col); //first digit
    printDigits(((val % 100) / 10), col + 4); //middle digit
    //printDigits(val % 10, col + 8); // working last digit
    printDigits(val * 0, col + 8);// removing last digit to display whole number
  }
  else {
    printDigits(val, col);
  }

…will then bite you when val < 10 since that only displays a single digit.
Have a think about what will be left on the screen in the other 2 digit positions if you are no longer clearing the screen every time.

Also…

  1. Why the special case for less than 10? The code for printing values of 10 or more will display 3 zeroes for values in the range 0 through 9 perfectly happily.
  2. Why is the function for displaying a single digit called “print digits” if it only prints a single digit? Your naming convention, but I wouldn’t say it was the greatest :o
  3. “val * 0” is a very funny way of coding “0”!

Edit:
If you want to make the units zero, but only for values of 10 or more, this code will work better…

printDigits(val / 100, col); //first digit
printDigits(((val % 100) / 10), col + 4); //middle digit
//printDigits(val % 10, col + 8); // working last digit
if ( val >= 10) {
  printDigits(0, col + 8);// removing last digit to display whole number
}
else {
  printDigits(val % 10, col + 8);
}

like i said, code taken from bits and pieces, just worked out what i need for it to work, so yes naming convention
is not good at all to say the least.

i have very little coding experience with c.

yeah slowly working though things i need and dont need, ran out of digital input room on uno so got a mega2560
and have 3 other boards trialing separate things out.

thankyou though pcbbc and i will try what you have written up