#include <LiquidCrystal.h> // include the LCD library
#include <DHT.h> // include the DHT library
#define DHTPIN 2 // define the DHT data pin
#define DHTTYPE DHT11 // define the DHT sensor type
DHT dht(DHTPIN, DHTTYPE); // create a DHT object
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // create an LCD object
void setup() {
lcd.begin(16, 2); // initialize the LCD with 16 columns and 2 rows
dht.begin(); // initialize the DHT sensor
}
void loop() {
float humidity = dht.readHumidity(); // read the humidity from the sensor
lcd.clear(); // clear the LCD screen
lcd.setCursor(0, 0); // set the cursor to the top left corner
lcd.print("Humidity: "); // display the text "Humidity: "
lcd.print(humidity); // display the humidity value
lcd.print("%"); // display the percent symbol
delay(1000); // wait for 1 second
}