I´ve been working on this project lately, I'm trying to use a temperature and humidity sensor DTH11 and display the temperature on a LCD and then if the temperature is over 35 degrees a fan turns on.
But in the coding I´m stuck with a problem, but I can't find it, it says it is related to the libraries.
Can somebody help me? I'm kind of in a rush, thanks.
This is the code and the problem:
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);;
#define DHTPIN 6
#define DHTTYPE DHT11
DHT sensor(DHTPIN, DHTTYPE);
int relay_pin = 9;
void setup() {
lcd.begin(16,2);
sensor.begin();
pinMode(relay_pin, OUTPUT);
digitalWrite(relay_pin, HIGH);
}
void loop() {
lcd.clear();
float t = sensor.readTemperature();
if (isnan(t)) {
lcd.print("Failed");
delay(1000);
return;
}
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.print(t);
lcd.print(" C");
if (t > 35){
digitalWrite(relay_pin, LOW);
lcd.setCursor(0,1);
lcd.print("Fan is ON ");
delay(10);
}
else{
digitalWrite(relay_pin, HIGH);
lcd.setCursor(0,1);
lcd.print("Fan is OFF ");
}
delay(2000);
}
Arduino: 1.8.7 (Windows 10), Card: "Arduino / Genuino Uno"
In file included from C: \ Users \ HP1 \ Documents \ Arduino \ sketch_jan14a \ sketch_jan14a.ino: 6: 0:
C: \ Users \ HP1 \ Documents \ Arduino \ libraries \ DHT_sensor_library / DHT_U.h: 25: 29: fatal error: Adafruit_Sensor.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for the Arduino / Genuino Uno card.
This report could have more information with
"Show detailed output during compilation"
option enabled in File -> Preferences