OLED Display code issue

Hi,
I have an Attiny85, a 0.96" 128X64 White OLED LED Display Module IIC I2C and a Light Sensor Module LDR. The code works okay but the issue is that the sensor value (sensorValue) continuously flickers, the rest of the code appears to be okay.

The code as follows:

#include <Tiny4kOLED.h>
#include <TinyWireM.h>
  
int sensorPin = 3; // select the input pin for LDR
int sensorValue = 0;
String LightStatus = "LED = ";

// OLED display TWI address
#define OLED_ADDR   0x3C

static char LLS[5];  

void setup()
{
pinMode(4, OUTPUT);

  oled.begin(); 
  oled.clear();
  oled.on();
  oled.switchRenderFrame();


}




void loop() 
{  

  sensorValue = analogRead(sensorPin);
  oled.setCursor(12, 5);
  oled.setFont(FONT6X8);
  oled.print((String)"LL = " + sensorValue );  


if (sensorValue > 500)
 {
  oled.clear();
  digitalWrite(4,HIGH); 
  oled.setFont(FONT6X8);
  oled.setCursor(12, 0);
  oled.print(LightStatus + " ON");  
//oled.switchFrame();
 }
 
 else 
 {
  oled.clear();
  digitalWrite(4,LOW); 
  oled.setFont(FONT6X8);
  oled.setCursor(12, 0);
  oled.print(LightStatus + " OFF");
//oled.switchFrame();
 }
oled.switchFrame();
//delay(1000);
}

Carlos1612:
the sensor value (sensorValue) continuously flickers

that's because you clear the screen and redisplay the value "like crazy" (as fast as the loop can spin).

You should check if the values to display have not changed, in which case no need to do anything and especially not do the oled.clear();. that's what causing the flickering