Offline
Зарегистрирован: 25.05.2019
Вот скетч:
#include «dht.h»
#define dht_apin A0 // Analog Pin sensor is connected to
dht DHT;
int relepin — 4;
int relepin2 — 3;
void setup(){
pinMode(relepin, OUTPUT);
pinMode(relepin2, OUTPUT);
Serial.begin(9600);
delay(500); / / Delay to let system boot
Serial.println(«DHT11 Humidity & temperature Sensornn»);
delay(1000 ); / / Wait before accessing Sensor
} / / end «setup()»
void loop(){
/ / Start of Program
DHT.read11(dht_apin);
Serial.print(«Current humidity = «);
Serial.print(DHT.humidity);
Serial.print(«%»);
Serial.print(«temperature = «);
Serial.print(DHT.temperature);
Serial.println(«C «);
delay(2000); / / Wait 5 seconds before accessing sensor again.
if(DHT.temperature < 18.00) digitalWrite(relepin, LOW);
else digitalWrite(relepin, HIGH);
if(DHT.humidity < 70.00) digitalWrite(relepin2, LOW);
else digitalWrite(relepin2, HIGH);
/ / Fastest should be once every two seconds.
} / / end loop()
ВОТ ошибка:
C:Users836D~1AppDataLocalTemparduino_modified_sketch_667312sketch_may26a.ino:1:17: fatal error: dht.h: No such file or directory
#include «dht.h»
^
compilation terminated.
exit status 1
Ошибка компиляции для платы Arduino/Genuino Uno.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
FlorentSms opened this issue
Oct 1, 2017
· 12 comments
Comments
Good evening,
Being a beginner in the arduino, I am currently experiencing a problem with my program. I try to read the data sent by a DHT11 type sensor.
I have correctly installed the library that you put online. I verified that it’s in the Arduino libraries folder and I have checked that the Arduino IDE visualizes it well.
But when I try to upload the program, that’s what he tells me:
https://puu.sh/xNwjj/e0bf912c99.png
https://puu.sh/xNwn6/1ad8fc18a3.png
https://puu.sh/xNwpB/23ace6dcb7.png
I think my library is well installed but I have the impression that it doesn’t recognize it.
I hope you can help me.
Good night.
Florent
@FlorentSms Can you delete the folder labeled DHT and download it through the Arduino IDE. The folder is not normally labeled just simply DHT as you show in your libraries folder. I don’t think that’s the issue but just to be on the safe side, I would remove the folder that you downloaded and said that you correctly installed. After you remove that folder go into Manage Libraries and search for DHT Sensor library and download it through the IDE. Try to upload it again to your Arduino after that is complete and report back if you are still having issues. The problem that you are having is normally related to something simple like it was not properly installed or that there are more than one copies of the DHT.h file floating around in your libraries folder.
Here is a picture of the Manage Libraries screen and the one you want to download to verify what you are after.
Also as an aside, you aren’t using the same library as this one, you are using the SimpleDHT library so if my idea fixes your problem that is possibly a start. The SimpleDHT code is hosted at the following link I believe, https://github.com/winlinvip/SimpleDHT
Hello @geofbaum ,
I have try your solutions but i have, for the 2 solutions, the same problem.
Thanks in advance.
Florent.
@FlorentSms Can you upload an image of what the files in your DHT library folder look like. I just want to check to make sure capitalization or if somehow the files are misnamed somehow.
Hi, could you solve your problem?
Adafruit_AM2320_sensor_library/Adafruit_AM2320.h:41:29: fatal error: Adafruit_Sensor.h: No such file or directory
@FlorentSms Can you delete the folder labeled DHT and download it through the Arduino IDE. The folder is not normally labeled just simply DHT as you show in your libraries folder. I don’t think that’s the issue but just to be on the safe side, I would remove the folder that you downloaded and said that you correctly installed. After you remove that folder go into Manage Libraries and search for DHT Sensor library and download it through the IDE. Try to upload it again to your Arduino after that is complete and report back if you are still having issues. The problem that you are having is normally related to something simple like it was not properly installed or that there are more than one copies of the DHT.h file floating around in your libraries folder.
Here is a picture of the Manage Libraries screen and the one you want to download to verify what you are after.
yeah i see and when i do it as you said, i also get the same error
delete DHT folder in libraries then install it via Arduino IDE and still get that error and don’t have any file DHT.h floating around my sketch
help me please, graceful and tks so much <3 @geofbaum
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: «Arduino Uno»
sketch_nov10a:1:10: fatal error: dht.h: No such file or directory
#include «dht.h»
compilation terminated.
exit status 1
dht.h: No such file or directory
This report would have more information with
«Show verbose output during compilation»
option enabled in File -> Preferences.
Puede ser porque falta una librería Adafruit Unified Sensor, esta viene al instalar todo desde el administrador de bibliotecas
Puede ser porque falta una librería Adafruit Unified Sensor, esta viene al instalar todo desde el administrador de bibliotecas
You Rock Arely! This worked
Skip to content
При подключении датчика влажности и температуры (DHT11 temp and humidity) — появляется ошибка в Arduino:
C:UsersСила МыслиDesktopDocumentsArduinoTemp and humidity DHT11Temp_and_humidity_DHT11Temp_and_humidity_DHT11.ino:1:17: fatal error: dht.h: No such file or directory
compilation terminated.
exit status 1
Ошибка компиляции для платы Arduino/Genuino Uno.
Ошибка говорит о том, что отсутствует библиотека dht.h в Arduino. Для установки библиотеки переходим Скетч -> Подключить библиотеку -> Управлять библиотеками
В поиске вводим dht и устанавливаем библиотеку DHT
Важным моментом также является то, как библиотека DHT подключается к проекту
Например вместо
#include <DHT.h>
а надо
#include <dht.h>
или наоборот.
Также устанавливаем библиотеку Adafruit Unified Sensor, чтобы исключить ошибку
sketchDHT_U.h:36:29: fatal error: Adafruit_Sensor.h: No such file or directory
Данная библиотека подключается так
#include <Adafruit_Sensor.h>
Часто бывает так, что встроенная библиотека тоже не подходит и необходимо найти ту библиотеку, которая подойдет к датчику на стороннем сайт в виде zip архива. В нашем случае подошла библиотека DHT-sensor-library. Чтобы eё загрузить в Arduino Скетч -> Подключить библиотеку -> Добавить .ZIP библиотеку и указываем путь до библиотеки.
В итоги датчик DHT11 temp and humidity стал правильно давать показания температуры и влажности.
2457
I am trying to read the humidity and temperature using a DHT11 temperature sensor for an Arduino UNO using the DHT.h
library. I have my code below:
#include <DHT.h>
#define dataPin 4
dht DHT;
void setup() {
Serial.begin(9600)
}
void loop() {
int readData = DHT.read11(dataPin);
float t = DHT.temperature;
float h = DHT.humidity;
Serial.println("Temperature: ")
Serial.print(t)
Serial.print(" ºC")
Serial.println("Humidity: ")
Serial.print(h)
Serial.print(" % ")
delay(2000)
}
When compiling the program, it gives me an error:
fatal error: DHT.h: No such file or directory
I have also tried with lower case letters, but it will not work. Is there any reason why? Do I have to install it? I have tried to search for the library in the Arduino app Sketch — Include Library — Manage Libraries, but the library is not there.
-
Всем привет!
Недавно купил датчик dht11 но не могу загрузить код в плату.9//Тестировалось на Arduino IDE 1.0.5
#include <dht11.h> // Добавляем библиотеку DHT11
dht11 DHT; // Объявление переменной класса dht11
#define DHT11_PIN 4 // Датчик DHT11 подключен к цифровому пину номер 4void setup(){
Serial.begin(9600); // Скорость работы порта
Serial.println(«DHT TEST PROGRAM «); // Выводим текст
Serial.print(«LIBRARY VERSION: «); // Выводим текст
Serial.println(DHT11LIB_VERSION);
Serial.println(); // Пустая строка
}void loop(){
int chk;
;
// Мониторинг ошибок
chk = DHT.read(DHT11_PIN); // Чтение данных
switch (chk){
case DHTLIB_OK:
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.println(«Checksum error, t«);
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.println(«Time out error, t«);
break;
default:
Serial.println(«Unknown error, t«);
break;
}
// Выводим показания влажности и температуры
Serial.print(«Humidity = «);
Serial.print(DHT.humidity, 1);
Serial.print(«, Temp = «);
Serial.println(DHT.temperature,1);
delay(1000);
}Все библиотеки у меня есть…
Выдает ошибку:
Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Плата:»Arduino/Genuino Uno»C:UsersbrastDocumentsArduinodhtdht.ino:2:73: fatal error: dht11.h: No such file or directory
#include <dht11.h> // Добавляем библиотеку DHT11
^
compilation terminated.
exit status 1
Ошибка компиляции для платы Arduino/Genuino Uno. -
Ну как же «все библиотеки есть», если компилятор пишет, что dht11.h нет. Либо вы установили библиотеку неправильно.
Последнее редактирование: 12 ноя 2017
Саня_76 и arkadyf нравится это.