Flickering OLED

modification of this program

https://www.google.com/search?q=arduino+current+previous&sca_esv

int previousSensorValue = 0;
int currentSensorValue;

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

void loop() {
  previousSensorValue = currentSensorValue; // Store the last reading
  currentSensorValue = analogRead(A0);    // Get the new reading from analog pin A0

  if (currentSensorValue != previousSensorValue) {
    Serial.print("Sensor value changed from ");
    Serial.print(previousSensorValue);
    Serial.print(" to ");
    Serial.println(currentSensorValue);
  }

  delay(100); // Small delay to prevent excessive readings
}