I have been able to use this sample code, to refresh on a change.
void loop()
{
int x = analogRead(A0);
if (x != prevX)
{
// write prevX in white
// write x in black
// remember last value
prevX = x;
}
delay(250);
}
the problem is I need to overwrite the old value in black but it has already updates.
sample of my code below
// for tft write
// Read the value of the sensor
String sensorVal0 = String(sensors.getTempCByIndex(0));
String sensorVal1 = String(sensors.getTempCByIndex(1));
// convert the reading to a char array
sensorVal0.toCharArray(sensorPrintout1, 8);
sensorVal1.toCharArray(sensorPrintout0, 8);
//tft stable temp
String y = sensorVal0;
if (y != prevY)
{
Serial.println("YYYYYYYY");
TFTscreen.setTextSize(2);
TFTscreen.stroke(0, 0, 0);
TFTscreen.text(sensorPrintout0, 0, 60);
delay(2000);
TFTscreen.stroke(100, 255, 100);
TFTscreen.text(sensorPrintout0, 0, 60);
prevY = y;
}
screen : tft 1.8 SPI 128*160"
temp sensors: DS18B20
code from : ONE WIRE / DALLAS TEMP
thanks