I am trying to compile the following code on a MKR1000, but I keep getting an error message: Arduino: 1.8.2 (Windows 10), Board: "Arduino/Genuino MKR1000" In file included from C:\Users\johno\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:22:0: C:\Users\johno\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory #include <Adafruit_Sensor.h> compilation terminated. exit status 1 Error compiling for board Arduino/Genuino MKR1000.
// Libraries
#include "DHT.h"
// Pins
int sensorPin = A0;
#define DHTPIN 5
#define DHTTYPE DHT22
// Initialize DHT sensor
DHT dht(DHTPIN, DHTTYPE, 15);
void setup() {
// Serial
Serial.begin(115200);
// Init DHT
dht.begin();
}
void loop() {
// Reading temperature and humidity
float humidity = dht.readHumidity();
// Read temperature as Celsius
float temperature = dht.readTemperature();
// Display
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
// Reading from analog sensor
int sensorValue = analogRead(sensorPin);
float lightLevel = sensorValue/1024.*100;
// Display
Serial.print("Light level: ");
Serial.print(lightLevel);
Serial.println(" %");
Serial.println();
// Wait
delay(500);
}
I have installed the DHT sensor library by Adafruit 1.3.0.
However, the Adafruit site says:
This library also includes an optional class for the DHT humidity and temperature sensor which is designed to work with the Adafruit unified sensor library.
You must have the following Arduino libraries installed to use this class:Adafruit Unified Sensor Library
There are no less than 15 unified libraries.
And just to be sure I checked again and YEP they are all still there in the regular desktop IDE.
There are 12 in CREATE editor as I checked that too.
Clearly you did something wrong or have something not setup correctly.
No to revive and old thread, but I'm having the same issue (fatal error). I did install/add the library but the issue is not resolved. Here is the Error Message I get:
LUXSensor_TSL2561_tutorial:2:10: fatal error: Adafruit_Sensor.h: No such file or directory
#include <Adafruit_Sensor.h>
^~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Adafruit_Sensor.h: No such file or directory
Thank you ... I did install the library (or so I thought). It turns out my anti-virus was causing the library folders to be empty. Issue resolved, I simply install libraries manually now. thank You