I’m using a DHT11 sensor, and I seem to have lots of problems with it. It keeps giving the error message
Arduino: 1.8.7 (Mac OS X), Board: "Arduino/Genuino Uno"
In file included from /Users/om/Documents/Arduino/libraries/DHT_sensor_library-1.3.0/DHT_U.cpp:22:0:
/Users/om/Documents/Arduino/libraries/DHT_sensor_library-1.3.0/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 Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
If you can help, here is the code:
//DHT11 Sensor:
#include "DHT.h"
#define DHTPIN 5 // which digital pin we're connected to
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
delay(300);
Serial.println("Humidity Sensor Test");
dht.begin();
delay(300);
}
void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
int h = dht.readHumidity();
int t = dht.readTemperature();
Serial.print("Temp: ");
Serial.print(t);
Serial.print("C, Humidity: ");
Serial.print(h);
Serial.println("%");
delay(2500);
}