Hello,
Im sorry I thought I attached my code in my first message. Thank you for the replies without it.
See code as follows
/* 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
void setup() {
// Begin Serial Comm
Serial.begin(9600);
Serial.println("ILI9341 Test!");
Serial.println("DHT test");
// Begin DHT11
dht.begin();
// Begin TFT
tft.begin();
//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)
float h = dht.readHumidity();
float 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"
float fahrenheitTemp = t * 9.0/5.0+32.0;
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
float 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
// print out the value for pH
Serial.println("SensorValue");
Serial.println(sensorValue);
Serial.println("Voltage");
Serial.println(Voltage);
Serial.println("pH");
Serial.println(pH);
// 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(230,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.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);
}
}