#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "DHT.h"
#include <Wire.h>
#define TFT_SCK 18
#define TFT_MOSI 23
#define TFT_MISO 19
#define TFT_CS 22
#define TFT_DC 21
#define TFT_RESET 17
#define DHTPIN 25
#define DHTTYPE DHT22
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
tft.begin();
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
tft.setRotation(1);
tft.fillScreen(0xFFFF);
tft.setCursor(18, 10);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(2);
tft.println("Sri Sairam Eng. Clg");
tft.setCursor(45, 42);
tft.setTextColor(ILI9341_BLUE);
tft.setTextSize(2);
tft.println("Tempature Sensor");
tft.setCursor(24, 82);
tft.setTextColor(ILI9341_BLACK);
tft.print(h);
tft.print(" ");
tft.print(char(223));
tft.print(" C");
delay(1000);
}