#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include <LiquidCrystal.h>

#define DHTPIN 38     // Digital pin connected to the DHT sensor 
#define DHTTYPE    DHT22     // Sensor del Wokwi

DHT_Unified dht(DHTPIN, DHTTYPE);

uint32_t delayMS;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void SensorDHT(){
  // Delay between measurements.
  delay(delayMS);
  //lcd.clear;
  // Get temperature event and print its value.
  sensors_event_t event;
  dht.temperature().getEvent(&event);
  lcd.setCursor(0,0);
  if (isnan(event.temperature)) {
    lcd.println(F("Error reading temperature!"));
  }
  else {
    lcd.print(F("Temp: "));
    lcd.print(event.temperature);
    lcd.println(F("°C"));
  }
  lcd.setCursor(0,1);
  // Get humidity event and print its value.
  dht.humidity().getEvent(&event);
  if (isnan(event.relative_humidity)) {
    lcd.println(F("Error reading humidity!"));
  }
  else {
    lcd.print(F("Hum: "));
    lcd.print(event.relative_humidity);
    lcd.println(F("%"));
  }
}

void setup() {
  Serial.begin(9600);
  // Initialize device.
  dht.begin();
  Serial.println(F("DHTxx Unified Sensor Example"));
  // Print temperature sensor details.
  sensor_t sensor;
  dht.temperature().getSensor(&sensor);
  delayMS = sensor.min_delay / 1000;
  lcd.begin(16, 2);
}

void loop() {
  SensorDHT();
}
$abcdeabcde151015202530354045505560fghijfghij