Error Compiliing

Hi! I need your help, I can’t compile. Thanks!

Here is the error:

Arduino: 1.8.7 (Windows 10), Board: “Arduino/Genuino Uno”

In file included from C:\Users\Admin\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:15:0:

C:\Users\Admin\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

Here is the code:

#include <DHT.h>
#include <DHT_U.h>

#include <LiquidCrystal.h>
#include <DHT.h>

/*****************************************************
 * name:Humiture Detection 
 * function:you can see the current value of humidity and temperature displayed on the I2C LCD1602.
 ******************************************************/

//include the libraries
#include <DHT.h>
#include <LiquidCrystal.h>
#include <Wire.h> 
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

dht DHT;//create a variable type of dht

const int DHT11_PIN= 7;//Humiture sensor attach to pin7

void setup()
{
  Serial.begin(9600);//initialize the serial monitor
  lcd.init();  //initialize the lcd
  lcd.backlight();  //open the backlight 
}

void loop()
{
  // READ DATA
  //Serial.println("DHT11:");
  
  int chk = DHT.read11(DHT11_PIN);//read the value returned from sensor
  switch (chk)
  {
  case DHTLIB_OK:  
    //Serial.println("OK!"); 
    break;
  case DHTLIB_ERROR_CHECKSUM: 
    //Serial.print("Checksum error,\t"); 
    break;
  case DHTLIB_ERROR_TIMEOUT: 
    //Serial.print("Time out error,\t"); 
    break;
  default: 
    //Serial.print("Unknown error,\t"); 
    break;
  }
  // DISPLAY DATA
  lcd.setCursor(0, 0);
  lcd.print("Tem:");
  //Serial.print("Tem:");
  lcd.print(DHT.temperature,1); //print the temperature on lcd
  // Serial.print(DHT.temperature,1);
  lcd.print(char(223));//print the unit" ℃ "
  lcd.print("C");
  // Serial.println(" C");
  lcd.setCursor(0, 1);
  lcd.print("Hum:");
  //Serial.print("Hum:");
  lcd.print(DHT.humidity,1); //print the humidity on lcd
  //Serial.print(DHT.humidity,1);
  lcd.print(" %"); 
  //Serial.println(" %");
  delay(200); //wait a while 
}

When you see a "No such file or directory" error it almost always means you need to install the library that contains the missing file.

Often the code you're compiling will come with documentation (either a comment or separate document) that tells you where to get the library dependencies.

In other cases the author of the code will not have been so kind and you'll need to go on a hunt for the missing library.

A good place to start is the Arduino IDE's Library Manager:

  • Sketch > Include Library > Manage Libraries...
  • In the "Filter your search..." box, type some keywords you have gleaned from the missing file name.
  • Scroll through the results for the right library. Click on it.
  • Click "Install".
  • Wait for installation to finish.
  • Click "Close".
  • Try compiling your code again.

If you have no luck in Library Manager then load up your favorite search engine and do a search for the missing filename. You will often get multiple results. If you have a lot of results you might add "arduino" as an additional search keyword. I will usually prefer results on github.com since that is where most Arduino libraries are hosted and downloading from there is fast and easy. In some cases there will be multiple libraries that contain the given filename and you'll need to do some evaluation to determine which seems the most appropriate, then try it out. After downloading the library you found you'll need to install it. This requires a different process than the Library Manager installation. You will find instructions here:

(deleted)