#include "DHTesp.h"
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
const int DHT_PIN = 15;
DHTesp dhtSensor;
void setup() {
Serial.begin(115200);
dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
}
void loop() {
TempAndHumidity data = dhtSensor.getTempAndHumidity();
lcd.setCursor(0,0);
lcd.println("Temp: " + String(data.temperature, 2) + "C");
lcd.setCursor(0,1);
lcd.println("Humidity: " + String(data.humidity, 1) + "%");
lcd.println("---");
delay(1000);
}