Display blinks with delay in sketch

Hello im trying to figure out how to keep my TFT LCD from blinking with my delay settings in my sketch.

/* Evan S Gray
 *  
*/



// Libraries to include
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "DHT.h"

// Define pins For the Adafruit TFT shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// what pin DHT sensor is connected to
#define DHTPIN 30     

// what type of DHT sensor
#define DHTTYPE DHT11   // DHT 11 


DHT dht(DHTPIN, DHTTYPE);


// Color definitions
#define BLACK    0x0000
#define BLUE     0x001F
#define RED      0xF800
#define GREEN    0x07E0
#define CYAN     0x07FF
#define MAGENTA  0xF81F
#define YELLOW   0xFFE0 
#define WHITE    0xFFFF

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired

// Fan relay pin
const byte fanPin = 31;
// Water relay pin
const byte waterPin = 32;


void setup() {

  // Begin Serial Comm
  Serial.begin(9600);



  // Begin DHT11
  dht.begin();
  // Begin TFT
  tft.begin();

  // Set the pinMode to output for the Fan relay control pin
  pinMode(fanPin, OUTPUT);

  // Set the pinMode to output for the Water relay control pin
  pinMode(waterPin, OUTPUT);
  
  //set screen rotation
  tft.setRotation(1);
  
  //fill screen black
  tft.fillScreen(BLACK);
  
  //set text wrap
  tft.setTextWrap(true);

  // Display text
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.println("Hello World!");

  tft.setTextColor(RED);
  tft.setTextSize(2);
  tft.println("Welcome to the first");

  tft.setTextColor(GREEN);
  tft.setTextSize(3);
  tft.println("Version of our Watering");

  tft.setTextColor(BLUE);
  tft.setTextSize(4);
  tft.println("System");

  delay(4000);
  
  tft.fillScreen(BLACK);
}

// the loop routine runs over and over again forever:
void loop() 
{

    // Reading temperature or humidity takes about 250 milliseconds!

    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

    int h = dht.readHumidity();

    int t = dht.readTemperature(); 


    // check if returns are valid, if they are NaN (not a number) then something went wrong!

    if (isnan(t) || isnan(h)) {

    Serial.println("Failed to read from DHT");

    } else {

    // Uncomment these lines if you prefer to use the Fahrenheit scale 

    // instead of Celsius. Remember to change line 44 so that the 

    // symbol is "F" instead of "C"

    int fahrenheitTemp = t * 9.0/5.0+32.0;

    if (fahrenheitTemp >= 80)
    {
    digitalWrite(fanPin, HIGH); // turn on relay
    }
    else if (fahrenheitTemp <= 75)
    {
    digitalWrite(fanPin, LOW);  // turn off relay
    } 

     Serial.print("Temperature: ");

     Serial.print(fahrenheitTemp);

     Serial.println(" F");

    

    Serial.print("Humidity: ");

    Serial.print(h);

    Serial.print(" %\t");


  
  
  // read the input on analog pin 10
  int sensorValue = analogRead(A10);     //get current sensorValue between 0-1000
  int Voltage = sensorValue*(5.0/1024.0);     //convert sensorValue to voltage 0-5v
  float pH = (Voltage*3.56)-1.889;     //convert voltage to pH

  // Read the input on analog pin 15
  int waterSensor = analogRead(A15);

  // Water sensor relay control
  if (waterSensor <= 1000)
  {
    digitalWrite(waterPin, HIGH); // turn on relay
  }
  else if (waterSensor >= 500)
  {
    digitalWrite(waterPin, LOW);  // turn off relay
  }

  
  // print out the value for pH

  Serial.println("pH");
  Serial.println(pH);
  Serial.println("Voltage");
  Serial.println(Voltage);
  Serial.println("Sensor");  
  Serial.println(sensorValue);
  Serial.println("Water Sensor");
  Serial.println(waterSensor);

  // print header 
  tft.setCursor(1,0);
  tft.setTextSize(3);
  tft.setTextColor(WHITE);
  tft.println("GrayMatter");
  tft.setCursor(25,25);
  tft.println("Growers");
  
  
  tft.drawRoundRect(210,10,90,45,25,WHITE);
  tft.setCursor(230,15);
  tft.setTextSize(2);
  tft.setTextColor(WHITE);
  tft.println("pH =");
  tft.setCursor(230,33); 
  tft.println(pH); // print pH value 0-14

  tft.drawRoundRect(210,65,90,45,25,WHITE);
  tft.setCursor(230,70);
  tft.setTextSize(2);
  tft.setTextColor(WHITE);
  tft.println("Temp");
  tft.setCursor(245,88); 
  tft.println(fahrenheitTemp); // print temp value F

  tft.drawRoundRect(210,120,90,45,25,WHITE);
  tft.setCursor(230,125);
  tft.setTextSize(2);
  tft.setTextColor(WHITE);
  tft.println("Hum ");
  tft.setCursor(230,143); 
  tft.println(h); // print Humidity value %
  tft.setCursor(260,143);
  tft.println("%");

  tft.drawRoundRect(210,175,90,45,25,WHITE);
  tft.setCursor(230,180);
  tft.setTextSize(2);
  tft.setTextColor(WHITE);
  tft.println("cO2 =");
  tft.setCursor(230,198); 
  tft.println(pH); // print cO2 value ppm
  delay(10000);        // delay in between reads for stability
  
  tft.fillScreen(BLACK);

}
 }
tft.fillScreen(BLACK);

Do you have to redraw everything every pass? Or can you update only sections of the screen that have changed since the last time?

Not related to the screen flickering but this line sticks out to me.

int Voltage = sensorValue*(5.0/1024.0);     //convert sensorValue to voltage 0-5v

You seem to be throwing away a lot of precision here. Since Voltage is an int, it can only hold the numbers 0,1,2,3,4. It can't even be a 5 because sensorValue has a max value of 1023 and (1023/1024) is less than 1 so it will be rounded down when converted to an integer.

Don't use println just print and keep relative positions. With tft whatever is written is persistent till changed. If you set text size and colour it doesn't need doing again unless you want to change it. In your code set it WHITE once and only change it when you need another colour.

Don't rewrite non changing text or rectangles in your loop. Write it once in Setup with relative position. Your Grey Matter , temp, hum, can be in Setup as they only need to be written once. It's the value you need to position and write.

For changing numerals just overwrite the smallest possible area with background colour to keep speed up and blank previous value. Then write new value.
Later with a larger code and screen usage this is important to keep redraw speed up.

+1 for not overwriting complete screen black. (I suspect that was because of changing value overwrite puzzling you )

For testing purposes I write the changing value background area colour to something like yellow so I can determine the actual size needed then I change it to correct background colour.

Oh and not really relevant now, but good practice to only define the colours you are using and any fonts you may use. This is because space is allocated for them. Add Magenta etc when you decide to use them. Comment them out for now.

Blackfin:

tft.fillScreen(BLACK);

Do you have to redraw everything every pass? Or can you update only sections of the screen that have changed since the last time?

No I do not want the whole screen to redraw! That is exactly my issue. I would like only the temperature and so on to redraw once they have changed. if the temp is 82 degrees and then it changes to 85 the parameter should redraw. so the parameters should redraw only on a change not every 10 seconds like it is now. I believe this is a job for millis timing but I don't understand how to implement the millis into my sketch.

Metallor:
Not related to the screen flickering but this line sticks out to me.

int Voltage = sensorValue*(5.0/1024.0);     //convert sensorValue to voltage 0-5v

You seem to be throwing away a lot of precision here. Since Voltage is an int, it can only hold the numbers 0,1,2,3,4. It can't even be a 5 because sensorValue has a max value of 1023 and (1023/1024) is less than 1 so it will be rounded down when converted to an integer.

What are you suggesting? I could use float?

I think what Blackfin is trying to ask is instead of setting the whole screen to black and re-writing every thing every pass of the loop, can you not just set the cursor to the position of the thing you want to overwrite and write there?

If you want to update only on a change, you need to keep track of the previous readings. So for every reading you have (e.g. waterSensor) you also want a variable to save the previous reading (e.g. oldWaterSensor). At the end of the loop write the current readings over the old readings (oldWaterSensor = waterSensor).
At the top of the loop once you have taken your readings, compare all your new readings with your old ones, and only redraw (by setting the cursor to that point, not setting the screen black and redrawing everything) if one of the values has changed.

And yes you should use float there because if you don't your pH will only give you one of 5 possible readings.

Metallor,

I don't understand your reply.

can you spell this out for me. I don't understand your intro to writing variables?

my code is as follows currently

/* Evan S Gray
 *  
*/



// Libraries to include
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "DHT.h"

// Define pins For the Adafruit TFT shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// what pin DHT sensor is connected to
#define DHTPIN 30     

// what type of DHT sensor
#define DHTTYPE DHT11   // DHT 11 


DHT dht(DHTPIN, DHTTYPE);


// Color definitions
#define BLACK    0x0000
#define BLUE     0x001F
#define RED      0xF800
#define GREEN    0x07E0
#define CYAN     0x07FF
#define MAGENTA  0xF81F
#define YELLOW   0xFFE0 
#define WHITE    0xFFFF

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired

// Fan relay pin
const byte fanPin = 31;
// Water relay pin
const byte waterPin = 32;


void setup() {

  // Begin Serial Comm
  Serial.begin(9600);



  // Begin DHT11
  dht.begin();
  // Begin TFT
  tft.begin();

  // Set the pinMode to output for the Fan relay control pin
  pinMode(fanPin, OUTPUT);

  // Set the pinMode to output for the Water relay control pin
  pinMode(waterPin, OUTPUT);
  
  //set screen rotation
  tft.setRotation(1);
  
  //fill screen black
  tft.fillScreen(BLACK);
  
  //set text wrap
  tft.setTextWrap(true);

  // Display text
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.println("Hello World!");

  tft.setTextColor(RED);
  tft.setTextSize(2);
  tft.println("Welcome to the first");

  tft.setTextColor(GREEN);
  tft.setTextSize(3);
  tft.println("Version of our Watering");

  tft.setTextColor(BLUE);
  tft.setTextSize(4);
  tft.println("System");

  delay(4000);
  
  tft.fillScreen(BLACK);
}

// the loop routine runs over and over again forever:
void loop() 
{

    // Reading temperature or humidity takes about 250 milliseconds!

    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

    int h = dht.readHumidity();

    int t = dht.readTemperature(); 


    // check if returns are valid, if they are NaN (not a number) then something went wrong!

    if (isnan(t) || isnan(h)) {

    Serial.println("Failed to read from DHT");

    } else {

    // Uncomment these lines if you prefer to use the Fahrenheit scale 

    // instead of Celsius. Remember to change line 44 so that the 

    // symbol is "F" instead of "C"

    int fahrenheitTemp = t * 9.0/5.0+32.0;

    if (fahrenheitTemp >= 80)
    {
    digitalWrite(fanPin, HIGH); // turn on relay
    }
    else if (fahrenheitTemp <= 75)
    {
    digitalWrite(fanPin, LOW);  // turn off relay
    } 

     Serial.print("Temperature: ");

     Serial.print(fahrenheitTemp);

     Serial.println(" F");

    

    Serial.print("Humidity: ");

    Serial.print(h);

    Serial.print(" %\t");


  
  
  // read the input on analog pin 10
  int sensorValue = analogRead(A10);     //get current sensorValue between 0-1000
  float Voltage = sensorValue*(5.0/1024.0);     //convert sensorValue to voltage 0-5v
  float pH = (Voltage*3.56)-1.889;     //convert voltage to pH

  // Read the input on analog pin 15
  int waterSensor = analogRead(A15);

  // Water sensor relay control
  if (waterSensor <= 1000)
  {
    digitalWrite(waterPin, HIGH); // turn on relay
  }
  else if (waterSensor >= 500)
  {
    digitalWrite(waterPin, LOW);  // turn off relay
  }

  
  // print out the value for pH

  Serial.println("pH");
  Serial.println(pH);
  Serial.println("Voltage");
  Serial.println(Voltage);
  Serial.println("Sensor");  
  Serial.println(sensorValue);
  Serial.println("Water Sensor");
  Serial.println(waterSensor);

  // print header 
  tft.setCursor(1,0);
  tft.setTextSize(3);
  tft.setTextColor(WHITE);
  tft.print("GrayMatter");
  tft.setCursor(25,25);
  tft.println("Growers");
  
  
  tft.drawRoundRect(210,10,90,45,25,WHITE);
  tft.setCursor(230,15);
  tft.setTextSize(2);
  tft.setTextColor(WHITE);
  tft.println("pH =");
  tft.setCursor(230,33); 
  tft.println(pH); // print pH value 0-14

  tft.drawRoundRect(210,65,90,45,25,WHITE);
  tft.setCursor(230,70);
  tft.println("Temp");
  tft.setCursor(245,88); 
  tft.println(fahrenheitTemp); // print temp value F

  tft.drawRoundRect(210,120,90,45,25,WHITE);
  tft.setCursor(230,125);
  tft.println("Hum ");
  tft.setCursor(230,143); 
  tft.println(h); // print Humidity value %
  tft.setCursor(260,143);
  tft.println("%");

  tft.drawRoundRect(210,175,90,45,25,WHITE);
  tft.setCursor(230,180);
  tft.println("cO2 =");
  tft.setCursor(230,198); 
  tft.println(pH); // print cO2 value ppm
  delay(10000);        // delay in between reads for stability
  
  tft.fillScreen(BLACK);

}
 }
int currentSensorReading;
int prevSensorReading;

setup()
{
  //set things up
  prevSensorReading = READ SENSOR HERE
}

loop()
{
  currentSensorReading = READ SENSOR HERE
  if (currentSensorReading != prevSensorReading)
  {
    UPDATE SCREEN
  }
  prevSensorReading = currentSensorReading;
}

This is the concept.

Hello all I have modified my code as follows.
Now my readings redraw over them selves.
so what I need is to have suggestions on how to just redraw the readings and not have them redraw over themselves.

/* Evan S Gray
 *  
*/



// Libraries to include
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "DHT.h"

// Define pins For the Adafruit TFT shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// what pin DHT sensor is connected to
#define DHTPIN 30     

// what type of DHT sensor
#define DHTTYPE DHT11   // DHT 11 


DHT dht(DHTPIN, DHTTYPE);


// Color definitions
#define BLACK    0x0000
#define BLUE     0x001F
#define RED      0xF800
#define GREEN    0x07E0
#define CYAN     0x07FF
#define MAGENTA  0xF81F
#define YELLOW   0xFFE0 
#define WHITE    0xFFFF

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
  Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired

// Fan relay pin
  const byte fanPin = 31;
// Water relay pin
  const byte waterPin = 32;


void setup() {

// Begin Serial Comm
  Serial.begin(9600);



// Begin DHT11
  dht.begin();
// Begin TFT
  tft.begin();

// Set the pinMode to output for the Fan relay control pin
  pinMode(fanPin, OUTPUT);

// Set the pinMode to output for the Water relay control pin
  pinMode(waterPin, OUTPUT);
  
//set screen rotation
  tft.setRotation(1);
  
//fill screen black
  tft.fillScreen(BLACK);
  
//set text wrap
  tft.setTextWrap(true);

// Display text
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);
  tft.setTextSize(1);
  tft.println("Hello World!");

  tft.setTextColor(RED);
  tft.setTextSize(2);
  tft.println("Welcome to the first");

  tft.setTextColor(GREEN);
  tft.setTextSize(3);
  tft.println("Version of our Watering");

  tft.setTextColor(BLUE);
  tft.setTextSize(4);
  tft.println("System");

  delay(4000);
  
  tft.fillScreen(BLACK);


// print header 
  tft.setCursor(1,0);
  tft.setTextSize(3);
  tft.setTextColor(WHITE);
  tft.print("GrayMatter");
  tft.setCursor(25,25);
  tft.println("Growers");

// Print pH header
  tft.drawRoundRect(210,10,90,45,25,WHITE);
  tft.setCursor(230,15);
  tft.setTextSize(2);
  tft.setTextColor(WHITE);
  tft.println("pH =");  

// Print temp header
  tft.drawRoundRect(210,65,90,45,25,WHITE);
  tft.setCursor(230,70);
  tft.println("Temp");

// Print Humidity header
  tft.drawRoundRect(210,120,90,45,25,WHITE);
  tft.setCursor(230,125);
  tft.println("Hum ");  

// Print c02 header  
  tft.drawRoundRect(210,175,90,45,25,WHITE);
  tft.setCursor(230,180);
  tft.println("cO2 =");

}
// the loop routine runs over and over again forever:
void loop() 
{

// Reading temperature or humidity takes about 250 milliseconds!

// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

    int h = dht.readHumidity();

    int t = dht.readTemperature(); 


// check if returns are valid, if they are NaN (not a number) then something went wrong!

    if (isnan(t) || isnan(h)) {

    Serial.println("Failed to read from DHT");

    } else {

// Uncomment these lines if you prefer to use the Fahrenheit scale 

// instead of Celsius. Remember to change line 44 so that the 

// symbol is "F" instead of "C"

    int fahrenheitTemp = t * 9.0/5.0+32.0;

    if (fahrenheitTemp >= 80)
    {
    digitalWrite(fanPin, HIGH); // turn on relay
    }
    else if (fahrenheitTemp <= 75)
    {
    digitalWrite(fanPin, LOW);  // turn off relay
    } 

// Print temp to serial
     Serial.print("Temperature: ");

     Serial.print(fahrenheitTemp);

     Serial.println(" F");

    
// Print humidity to serial
    Serial.print("Humidity: ");

    Serial.print(h);

    Serial.print(" %\t");


  
  
// read the input on analog pin 10
    int sensorValue = analogRead(A10);     //get current sensorValue between 0-1000
    int Voltage = sensorValue*(5.0/1024.0);     //convert sensorValue to voltage 0-5v
    float pH = (Voltage*3.56)-1.889;     //convert voltage to pH

// Read the input on analog pin 15
    int waterSensor = analogRead(A15);

// Water sensor relay control
    if (waterSensor <= 1000)
  {
    digitalWrite(waterPin, HIGH); // turn on relay
  }
    else if (waterSensor >= 500)
  {
    digitalWrite(waterPin, LOW);  // turn off relay
  }

  
// print out the value for pH

    Serial.println("pH");
    Serial.println(pH);
    Serial.println("Voltage");
    Serial.println(Voltage);
    Serial.println("Sensor");  
    Serial.println(sensorValue);
    Serial.println("Water Sensor");
    Serial.println(waterSensor);
  
  
// Print pH value 0-14
    tft.setCursor(230,33); 
    tft.println(pH); 

// print temp value F
    tft.setCursor(245,88); 
    tft.println(fahrenheitTemp); 

// print Humidity value %
    tft.setCursor(230,143); 
    tft.println(h); 
    tft.setCursor(260,143);
    tft.println("%");
  
// print cO2 value ppm
    tft.setCursor(230,198); 
    tft.println(pH); 
    delay(10000);        // delay in between reads for stability

}
 }

Does this work?

// Libraries to include
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "DHT.h"

// Define pins For the Adafruit TFT shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// what pin DHT sensor is connected to
#define DHTPIN 30     

// what type of DHT sensor
#define DHTTYPE DHT11   // DHT 11 


DHT dht(DHTPIN, DHTTYPE);


// Color definitions
#define BLACK    0x0000
#define BLUE     0x001F
#define RED      0xF800
#define GREEN    0x07E0
#define CYAN     0x07FF
#define MAGENTA  0xF81F
#define YELLOW   0xFFE0 
#define WHITE    0xFFFF

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
  Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired

// Fan relay pin
const byte fanPin = 31;
// Water relay pin
const byte waterPin = 32;

float
    lastpH = -1.0;
int
    lastHumid = -1,
    lastTemp = -50;

void setup() 
{

    // Begin Serial Comm
    Serial.begin(9600);
    
    // Begin DHT11
    dht.begin();
    // Begin TFT
    tft.begin();

    // Set the pinMode to output for the Fan relay control pin
    pinMode(fanPin, OUTPUT);

    // Set the pinMode to output for the Water relay control pin
    pinMode(waterPin, OUTPUT);
  
    //set screen rotation
    tft.setRotation(1);
  
    //fill screen black
    tft.fillScreen(BLACK);
  
    //set text wrap
    tft.setTextWrap(true);

    // Display text
    tft.setCursor(0, 0);
    tft.setTextColor(WHITE);
    tft.setTextSize(1);
    tft.println("Hello World!");

    tft.setTextColor(RED);
    tft.setTextSize(2);
    tft.println("Welcome to the first");

    tft.setTextColor(GREEN);
    tft.setTextSize(3);
    tft.println("Version of our Watering");

    tft.setTextColor(BLUE);
    tft.setTextSize(4);
    tft.println("System");

    delay(4000);
  
    tft.fillScreen(BLACK);

    // print header 
    tft.setCursor(1,0);
    tft.setTextSize(3);
    tft.setTextColor(WHITE);
    tft.print("GrayMatter");
    tft.setCursor(25,25);
    tft.println("Growers");

    // Print pH header
    tft.drawRoundRect(210,10,90,45,25,WHITE);
    tft.setCursor(230,15);
    tft.setTextSize(2);
    tft.setTextColor(WHITE);
    tft.println("pH =");  

    // Print temp header
    tft.drawRoundRect(210,65,90,45,25,WHITE);
    tft.setCursor(230,70);
    tft.println("Temp");

    // Print Humidity header
    tft.drawRoundRect(210,120,90,45,25,WHITE);
    tft.setCursor(230,125);
    tft.println("Hum ");  

    // Print c02 header  
    tft.drawRoundRect(210,175,90,45,25,WHITE);
    tft.setCursor(230,180);
    tft.println("cO2 =");

}//setup

// the loop routine runs over and over again forever:
void loop() 
{

    // Reading temperature or humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

    int h = dht.readHumidity();

    int t = dht.readTemperature(); 


    // check if returns are valid, if they are NaN (not a number) then something went wrong!
    if (isnan(t) || isnan(h)) 
    {
        Serial.println("Failed to read from DHT");

    }//if
    else 
    {

        int fahrenheitTemp = t * 9.0/5.0+32.0;
        if (fahrenheitTemp >= 80)
        {
            digitalWrite(fanPin, HIGH); // turn on relay
        }//if
        else if (fahrenheitTemp <= 75)
        {
            digitalWrite(fanPin, LOW);  // turn off relay
        }//else
        
        // Print temp to serial
        Serial.print("Temperature: ");
        Serial.print(fahrenheitTemp);
        Serial.println(" F");

        // Print humidity to serial
        Serial.print("Humidity: ");
        Serial.print(h);
        Serial.print(" %\t");
  
        // read the input on analog pin 10
        int sensorValue = analogRead(A10);     //get current sensorValue between 0-1000
        int Voltage = sensorValue*(5.0/1024.0);     //convert sensorValue to voltage 0-5v
        float pH = (Voltage*3.56)-1.889;     //convert voltage to pH

        // Read the input on analog pin 15
        int waterSensor = analogRead(A15);

        // Water sensor relay control
        if( waterSensor <= 1000 )
        {
            digitalWrite(waterPin, HIGH); // turn on relay
        }
        else if( waterSensor >= 500 )
        {
            digitalWrite(waterPin, LOW);  // turn off relay
        }

        // print out the value for pH
        Serial.println("pH");
        Serial.println(pH);
        Serial.println("Voltage");
        Serial.println(Voltage);
        Serial.println("Sensor");  
        Serial.println(sensorValue);
        Serial.println("Water Sensor");
        Serial.println(waterSensor);

        if( pH != lastpH )
        {
            lastpH = pH;
            // Print pH value 0-14
            tft.drawRect(230,33,70,20,WHITE);
            tft.setCursor(230,33); 
            tft.println(pH); 
            
        }//if
        
        // print temp value F
        if( fahrenheitTemp != lastTemp )
        {
            lastTemp = fahrenheitTemp;        
            tft.drawRect(245,88,55,20,WHITE);
            tft.setCursor(245,88); 
            tft.println(fahrenheitTemp); 
            
        }//if

        if( h != lastHumid )
        {
            lastHumid = h;
            // print Humidity value %
            tft.drawRect(230,143,70,20,WHITE);
            tft.setCursor(230,143); 
            tft.println(h); 
            tft.setCursor(260,143);
            tft.println("%");
            
        }//if

        //printing pH twice?
        // print cO2 value ppm 
        //tft.setCursor(230,198); 
        //tft.println(pH); 
    
        delay(10000);        // delay in between reads for stability

    }//else
    
}//loop

OK I outlined the re-drawing of the value for you, but you chose to ignore certain things.

Println is for serial monitor not the display, it uses just tft.print.

Comment out unneccessary colours. It's just good practice.

I think you've grasped what I wrote re setup.

Be aware that certain displays despite your best efforts will 'nudge' the numeral start position when it changes to a high value. So, 2.34 is fine but when it changes to say 113.65 it will nudge the figures one pixel relative to setpoint. With fast changing values it draws your eyes attention to it.

Nice to see Blackfin put a 5 degree hysteresis in there, most newbies when writing this forget and wonder why it cycles relays around set temperature.

tasmod I have made all the changes you suggested to my code and it still redraws the parameters over each other . I again believe this is a job for millis timing. the temp and so on now redraw over themselves. >:(

/* Evan S Gray
 *  
*/



// Libraries to include
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "DHT.h"

// Define pins For the Adafruit TFT shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10

// what pin DHT sensor is connected to
#define DHTPIN 30     

// what type of DHT sensor
#define DHTTYPE DHT11   // DHT 11 


DHT dht(DHTPIN, DHTTYPE);


// Color definitions
#define BLACK    0x0000
//#define BLUE     0x001F
//#define RED      0xF800
//#define GREEN    0x07E0
//#define CYAN     0x07FF
//#define MAGENTA  0xF81F
//#define YELLOW   0xFFE0 
#define WHITE    0xFFFF

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
  Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired

// Fan relay pin
  const byte fanPin = 31;
// Water relay pin
  const byte waterPin = 32;


void setup() {

// Begin Serial Comm
  Serial.begin(9600);



// Begin DHT11
  dht.begin();
// Begin TFT
  tft.begin();

// Set the pinMode to output for the Fan relay control pin
  pinMode(fanPin, OUTPUT);

// Set the pinMode to output for the Water relay control pin
  pinMode(waterPin, OUTPUT);
  
//set screen rotation
  tft.setRotation(1);
  
//fill screen black
  tft.fillScreen(BLACK);
  
//set text wrap
  tft.setTextWrap(true);

// Display text
  tft.setCursor(0, 0);
  tft.setTextColor(WHITE);
  tft.setTextSize(3);
  tft.print("Hello World! Welcome to the first version of our watering system");

  delay(4000);
  
  tft.fillScreen(BLACK);


// print header 
  tft.setCursor(1,0);
  tft.setTextSize(3);
  tft.setTextColor(WHITE);
  tft.print("GrayMatter");
  tft.setCursor(25,25);
  tft.print("Growers");

// Print pH header
  tft.drawRoundRect(210,10,90,45,25,WHITE);
  tft.setCursor(230,15);
  tft.setTextSize(2);
  tft.setTextColor(WHITE);
  tft.print("pH =");  

// Print temp header
  tft.drawRoundRect(210,65,90,45,25,WHITE);
  tft.setCursor(230,70);
  tft.print("Temp");

// Print Humidity header
  tft.drawRoundRect(210,120,90,45,25,WHITE);
  tft.setCursor(230,125);
  tft.print("Hum ");  

// Print c02 header  
  tft.drawRoundRect(210,175,90,45,25,WHITE);
  tft.setCursor(230,180);
  tft.print("cO2 =");

}
// the loop routine runs over and over again forever:
void loop() 
{

// Reading temperature or humidity takes about 250 milliseconds!

// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

    int h = dht.readHumidity();

    int t = dht.readTemperature(); 


// check if returns are valid, if they are NaN (not a number) then something went wrong!

    if (isnan(t) || isnan(h)) {

    Serial.println("Failed to read from DHT");

    } else {

// Uncomment these lines if you prefer to use the Fahrenheit scale 

// instead of Celsius. Remember to change line 44 so that the 

// symbol is "F" instead of "C"

    int fahrenheitTemp = t * 9.0/5.0+32.0;

    if (fahrenheitTemp >= 80)
    {
    digitalWrite(fanPin, HIGH); // turn on relay
    }
    else if (fahrenheitTemp <= 75)
    {
    digitalWrite(fanPin, LOW);  // turn off relay
    } 

// Print temp to serial
     Serial.println("Temperature: ");

     Serial.println(fahrenheitTemp);

     Serial.println(" F");

    
// Print humidity to serial
    Serial.println("Humidity: ");

    Serial.println(h);

    Serial.println(" %\t");


  
  
// read the input on analog pin 10
    int sensorValue = analogRead(A10);     //get current sensorValue between 0-1000
    int Voltage = sensorValue*(5.0/1024.0);     //convert sensorValue to voltage 0-5v
    float pH = (Voltage*3.56)-1.889;     //convert voltage to pH

// Read the input on analog pin 15
    int waterSensor = analogRead(A15);

// Water sensor relay control
    if (waterSensor <= 1000)
  {
    digitalWrite(waterPin, HIGH); // turn on relay
  }
    else if (waterSensor >= 500)
  {
    digitalWrite(waterPin, LOW);  // turn off relay
  }

  
// print out the value for pH

    Serial.println("pH");
    Serial.println(pH);
    Serial.println("Voltage");
    Serial.println(Voltage);
    Serial.println("Sensor");  
    Serial.println(sensorValue);
    Serial.println("Water Sensor");
    Serial.println(waterSensor);
  
  
// Print pH value 0-14
    tft.setCursor(230,33); 
    tft.print(pH); 

// print temp value F
    tft.setCursor(245,88); 
    tft.print(fahrenheitTemp); 

// print Humidity value %
    tft.setCursor(230,143); 
    tft.print(h); 
    tft.setCursor(260,143);
    tft.print("%");
  
// print cO2 value ppm
    tft.setCursor(230,198); 
    tft.print(pH); 
    delay(10000);        // delay in between reads for stability

}
 }

You missed the point about drawing the background then the value.

I'm a bit tired to calculate the position properly but this will give you the idea for what I mean. It should draw a filled rectangle at background colour, then the value. So on each loop it draws over the value then redraws the new value. Uncomment yellow for now to see it, then change it to your background colour once you have the position and size correct. Then you will only see the value change.
Think of it as writing the value on a bit of white paper in ink. Then apply white paint over the value to cover it. Then write the value again and so on.

// Print pH value 0-14
    tft.fillRect(229, 32, 50, 18, YELLOW);
    tft.setCursor(230,33);
    tft.print(pH);

everone:
tasmod I have made all the changes you suggested to my code and it still redraws the parameters over each other . I again believe this is a job for millis timing. the temp and so on now redraw over themselves. >:(

Did you try the code I posted?

tasmod:
You missed the point about drawing the background then the value.

I'm a bit tired to calculate the position properly but this will give you the idea for what I mean. It should draw a filled rectangle at background colour, then the value. So on each loop it draws over the value then redraws the new value. Uncomment yellow for now to see it, then change it to your background colour once you have the position and size correct. Then you will only see the value change.
Think of it as writing the value on a bit of white paper in ink. Then apply white paint over the value to cover it. Then write the value again and so on.

// Print pH value 0-14

tft.fillRect(229, 32, 50, 18, YELLOW);
    tft.setCursor(230,33);
    tft.print(pH);

Thank you,

the code once finished is as follows.

// Print pH value 0-14
tft.fillRoundRect(212,12,86,41,25,BLACK);
tft.setCursor(230,15);
tft.setTextSize(2);
tft.setTextColor(WHITE);
tft.print("pH =");
tft.setCursor(230,33);
tft.print(pH);

// print temp value F
tft.fillRoundRect(212,67,86,41,25,BLACK);
tft.setCursor(230,70);
tft.print("Temp");
tft.setCursor(245,88);
tft.print(fahrenheitTemp);

// print Humidity value %
tft.fillRoundRect(212,122,86,41,25,BLACK);
tft.setCursor(230,125);
tft.print("Hum ");
tft.setCursor(230,143);
tft.print(h);
tft.setCursor(260,143);
tft.print("%");

// print cO2 value ppm
tft.fillRoundRect(212,177,86,41,25,BLACK);
tft.setCursor(230,180);
tft.print("cO2 =");
tft.setCursor(230,198);
tft.print(pH);
delay(10000); // delay in between reads for stability