#include <DHT.h>
#include <LiquidCrystal.h>
DHT dht(32, DHT22); // Define the DHT22 pin
// Define the pins for the LCD display
LiquidCrystal lcd(12, 14, 5, 4, 18, 2);
void setup() {
dht.begin();
lcd.begin(16, 2);
lcd.print("Temp: Hum:");
Serial.begin(9600);
}
void loop() {
delay(2000); // Delay to allow sensor stabilization
float temperature = dht.readTemperature(); // Read temperature from DHT22
float humidity = dht.readHumidity(); // Read humidity from DHT22
lcd.setCursor(0, 1);
// lcd.print("Temp: ");
lcd.print(temperature);
lcd.print(" C ");
// lcd.print("Humidity: ");
lcd.print(humidity);
lcd.print(" %");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.print(" C, Humidity: ");
Serial.print(humidity);
Serial.println(" %");
delay(100); // Wait before taking another measurement
}