/**
ESP32 + DHT22 Example for Wokwi
https://wokwi.com/arduino/projects/322410731508073042
*/
#include "DHTesp.h"
#include <LiquidCrystal_I2C.h>
const int DHT_PIN = 15;
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
DHTesp dhtSensor;
void setup() {
Serial.begin(115200);
dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
LCD.init();
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) + "%");
delay(1000);
}