Error message!

Hi, I had an error message and I'm unsure how to resolve it, could I grab some assistance!

Code:

#include <DHTesp.h>

// include the library code:
#include <LiquidCrystal.h>

// set the DHTesp Pin
#define DHTPIN 8

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
#define DHTTYPE DHT11
DHTesp dht(DHTPIN, DHTTYPE);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  dht.begin();

  // Print a message to the LCD.
  lcd.print("Temp:  Humidity:");
}

void loop() {
  delay(500);
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // read humidity
  float h = dht.readHumidity();
  //read temperature in Fahrenheit
  float f = dht.readTemperature(true);

  if (isnan(h) || isnan(f)) {
    lcd.print("ERROR");
    return;
  }

  lcd.print(f);
  lcd.setCursor(7, 1);
  lcd.print(h);
}

  lcd.print(f);
  lcd.setCursor(7,1);
  lcd.print(h);  
}

Error Message:

Arduino: 1.8.13 (Windows 7), Board: "Arduino Uno"





















sketch_oct14b:11:17: error: 'DHT11' was not declared in this scope

 #define DHTTYPE DHT11

                 ^

C:\Users\RiaAryan\AppData\Local\Temp\arduino_modified_sketch_496794\sketch_oct14b.ino:12:20: note: in expansion of macro 'DHTTYPE'

 DHTesp dht(DHTPIN, DHTTYPE);

                    ^~~~~~~

C:\Users\RiaAryan\AppData\Local\Temp\arduino_modified_sketch_496794\sketch_oct14b.ino:11:17: note: suggested alternative: 'DHTesp'

 #define DHTTYPE DHT11

                 ^

C:\Users\RiaAryan\AppData\Local\Temp\arduino_modified_sketch_496794\sketch_oct14b.ino:12:20: note: in expansion of macro 'DHTTYPE'

 DHTesp dht(DHTPIN, DHTTYPE);

                    ^~~~~~~

C:\Users\RiaAryan\AppData\Local\Temp\arduino_modified_sketch_496794\sketch_oct14b.ino: In function 'void setup()':

sketch_oct14b:17:7: error: 'class DHTesp' has no member named 'begin'; did you mean 'getPin'?

   dht.begin();

       ^~~~~

       getPin

C:\Users\RiaAryan\AppData\Local\Temp\arduino_modified_sketch_496794\sketch_oct14b.ino: In function 'void loop()':

sketch_oct14b:29:17: error: 'class DHTesp' has no member named 'readHumidity'; did you mean 'getHumidity'?

   float h = dht.readHumidity();

                 ^~~~~~~~~~~~

                 getHumidity

sketch_oct14b:31:17: error: 'class DHTesp' has no member named 'readTemperature'; did you mean 'getTemperature'?

   float f = dht.readTemperature(true);

                 ^~~~~~~~~~~~~~~

                 getTemperature

exit status 1

'DHT11' was not declared in this scope



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I added the new code,

I recommend using DHT library from Adafruit. Follow the instruction in this Arduino - DHT sensor tutorial

Okay I'll try it