#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <DHT.h>
DHT dht(8,DHT22);
Adafruit_ILI9341 tft = Adafruit_ILI9341(3,2);
void setup() {
dht.begin();
tft.begin();
}
void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
tft.setCursor(20, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(2);
tft.println(t);
tft.setCursor(28, 160);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println(h);
}Loading
st-nucleo-c031c6
st-nucleo-c031c6