Follow this link: How to Set Up the DHT11 Humidity Sensor on an Arduino
Then download the library with a click on the DHTLib text you can see in the picture below:
Add the .zip as library in the Arduino IDE
The go to Sketch -> Include Library
Click on your library
Now you should see something like this:
#include <dht.h> //This is the correct include of the DHTLib from www.circuitbasics.com
Here is the complete code and it compiles:
//This compiles for Arduino UNO
#include <Wire.h>
//#include <DHT.h> //This is what you had included in your first post
#include <dht.h> //This is the correct include of the DHTLib from www.circuitbasics.com
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//DHT dht; //This is what you had included in your first post
dht DHT; //This is correct for the "<dht.h>" include from above
#define DHT11_PIN 7
void setup() {
lcd.begin(16, 2);
}
void loop()
{
int chk = DHT.read11(DHT11_PIN);
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(DHT.temperature);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(DHT.humidity);
lcd.print("%");
delay(1000);
}
