#include <LiquidCrystal.h>
#include <DHT.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
DHT sensorht(2, DHT22);
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
sensorht.begin();
Serial.println("Iniciando...");
lcd.setCursor(0, 0);
lcd.print("HUMEDAD RELATIVA");
lcd.setCursor(0, 1);
lcd.print(" Y TEMPERATURA ");
delay(2000);
}
void loop() {
float h = sensorht.readHumidity();
float t = sensorht.readTemperature();
Serial.print("Humedad: ");
Serial.print(h);
Serial.println(" %");
Serial.print("Temperatura: ");
Serial.print(t);
Serial.println(" °C");
lcd.setCursor(0, 0);
lcd.print("H.R.: ");
lcd.print(h);
lcd.print(" % ");
lcd.setCursor(0, 1);
lcd.print("Temp.: ");
lcd.print(t);
lcd.print(" ");
lcd.print((char)223);
lcd.print("C " );
delay(2000);
}