Basically running a small temperature and humidity controller. everything is up and running and working well except that when I change the values they appear to "flash".
I have tried a few things so far, currently I write over the existing number in white (white back screen) then write the new number in black. I have also tried drawing a white rectangle where the number was then rewriting a new one in black but this has the same effect.
Am I missing something?
void currentValues(){
tft.println(" ");
tft.println(" ");
tft.println(" ");
tft.println(" ");
tft.println(" ");
tft.println(" ");
tft.println(" ");
tft.setTextSize(2);
tft.setTextColor(ILI9341_BLACK);
tft.println(" Current Case");
tft.print(" Temperature: ");
tft.println("C");
tft.print(" Re/Humidity: ");
tft.println("%");
}
void checkInput(){
TSPoint p = ts.getPoint();
//FOR TEST PURPOSES ONLY
if (p.z > ts.pressureThreshhold) {
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
delay(100);
}
if (p.y>460 && p.y<660 && p.x>160 && p.x<430){
Serial.println ("Button 1 pressed");
previousTempValue = tempValue;
tempValue = tempValue+1;
delay (500); }
if (p.y>150 && p.y<350 && p.x>160 && p.x<430){
Serial.println ("Button 2 pressed");
previousTempValue = tempValue;
tempValue = tempValue-1;
delay (500);}
if (p.y>460 && p.y<660 && p.x>580 && p.x<850){
Serial.println ("Button 3 pressed");
previousHumiValue = humiValue;
humiValue = humiValue+1;
delay (500);}
if (p.y>150 && p.y<350 && p.x>580 && p.x<850){
Serial.println ("Button 4 pressed");
previousHumiValue = humiValue;
humiValue = humiValue-1;
delay (500);}
}
void selectValues(){
tft.setCursor(30,195);
tft.setTextSize(4);
if (tempValue != previousTempValue){
tft.setTextColor(ILI9341_WHITE),(ILI9341_WHITE);
tft.print(previousTempValue);
delay(10);
tft.setCursor(30,195);
tft.setTextSize(4);
}
tft.setTextColor(ILI9341_BLACK);
tft.print(tempValue);
tft.print("C");
tft.setCursor(150,195);
tft.setTextSize(4);
if (humiValue != previousHumiValue){
tft.setTextColor(ILI9341_WHITE),(ILI9341_WHITE);
tft.print(previousHumiValue);
delay(10);
tft.setCursor(150,195);
tft.setTextSize(4);
}
tft.setTextColor(ILI9341_BLACK);
tft.print(humiValue);
tft.println("%");
}