I copied this code from the Arduino Project Hub and I get the following error message when I check the code before I try to download. How do I correct this issue as I get this issue when ever I copy or download code that has been written from sources such a Githup. I will post the error message and the cod will follow.
Error message:
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Arduino Uno"
In file included from C:\Users\leave\OneDrive\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:15:0:
C:\Users\leave\OneDrive\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:36:10: fatal error: Adafruit_Sensor.h: No such file or directory
#include <Adafruit_Sensor.h>
^~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Code:
/*
- Library required: -
- "LiquidCrystal", "DHT_sensor_library" and "Adafruit_Sensor-master" -
- Download: Adafruit_Sensor-master on Github: GitHub - adafruit/Adafruit_Sensor: Common sensor library -
- Put it in your Arduiono dictory "libraries" -
- License: GNU General Public License version 3 or later (GPL3+) -
- By HilfePlus -
*/
// --Library-- / Bibliotheken
#include <LiquidCrystal.h>
#include <DHT.h>
// Sensor DHT-11 (DHT-11 Temperature and Humidity Sensor)
#define DHTPIN 8
#define DHTTYPE DHT11
// LCD Display (PIN)(LCD1602 Module)
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// Serial Monitor
Serial.begin(9600);
// LCD Display
lcd.begin(16, 2);
lcd.setCursor(7,1);
lcd.print("By Hilfe+");
dht.begin();
// LCD Display (Temp and Humidity)
lcd.setCursor(0,0);
lcd.print("Temp:");
lcd.setCursor(0,1);
lcd.print("Humid:");
delay(1500);
}
void loop() {
lcd.setCursor(12,1);
lcd.print("%");
// Load (Arrow)
delay(550);
lcd.setCursor(13,0);
lcd.print("<");
delay(50);
lcd.setCursor(14,0);
lcd.print("-");
delay(50);
lcd.setCursor(15,0);
lcd.print("-");
delay(50);
lcd.setCursor(15,1);
lcd.print("-");
delay(50);
lcd.setCursor(14,1);
lcd.print("-");
delay(50);
lcd.setCursor(13,1);
lcd.print("<");
// ...
lcd.setCursor(12,0);
lcd.print(" ");
// -- Temp and Humidity --
// Temp = Temperature in Fahrenheit and Humid = Humidity
float f = dht.readHumidity();
float c = dht.readTemperature(true);
// Sensor Error (For Example No Sensor)
if (isnan(f) && (c)) {
lcd.clear();
lcd.setCursor(4,1);
lcd.print("|SENSOR|");
lcd.setCursor(4,0);
lcd.print("|ERROR |");
delay(1000);
return;
}
// LCD Display (values)
lcd.setCursor(7,0);
lcd.print(c);
lcd.setCursor(7,1);
lcd.print(f);
// Serial Monitor
Serial.println("- Result -");
Serial.print("Temp: ");
Serial.println(c);
Serial.print("Humid: ");
Serial.println(f);
Serial.println("- - - - - -");
Serial.println(" ");
Serial.println(" ");
// Ende (Arrow)
delay(400);
lcd.setCursor(15,1);
lcd.print(" ");
delay(50);
lcd.setCursor(14,1);
lcd.print(" ");
delay(50);
lcd.setCursor(13,1);
lcd.print(" ");
delay(50);
lcd.setCursor(13,0);
lcd.print(" ");
delay(50);
lcd.setCursor(14,0);
lcd.print(" ");
delay(50);
lcd.setCursor(15,0);
lcd.print(" ");
delay(50);
}