N newbie Member Licensed User Longtime User Dec 3, 2016 #1 Hello, has someone a directly functioning rDHT library ? i have download and try all versions i have found in the forums, but nothing works ( with different messages). I have try the suggestions in the threads but no prosperity. After more than one hour i am frustrated. THANKS for any help
Hello, has someone a directly functioning rDHT library ? i have download and try all versions i have found in the forums, but nothing works ( with different messages). I have try the suggestions in the threads but no prosperity. After more than one hour i am frustrated. THANKS for any help
P positrom2 Active Member Licensed User Longtime User Dec 3, 2016 #2 newbie said: After more than one hour i am frustrated. Click to expand... That's much too early. I just tried some of the DHT examples here, but none worked. They all give the infameous error fatal error: dht.h: No such file or directory #include <dht.h> Click to expand... There are a couple of posts here how to fix it, but I was not able (within 1/2 hour). What works fine is Erel's example on the BMP280 for the ESP8266. So, it might be best if you indicate on which systems you wish to work. Last edited: Dec 3, 2016 Upvote 0
newbie said: After more than one hour i am frustrated. Click to expand... That's much too early. I just tried some of the DHT examples here, but none worked. They all give the infameous error fatal error: dht.h: No such file or directory #include <dht.h> Click to expand... There are a couple of posts here how to fix it, but I was not able (within 1/2 hour). What works fine is Erel's example on the BMP280 for the ESP8266. So, it might be best if you indicate on which systems you wish to work.
derez Expert Licensed User Longtime User Dec 3, 2016 #3 positrom2 said: That's much too early. I just tried some of the DHT examples here, but none worked. They all give the error There are a couple of posts here how to fix it, but I was not able (within 1/2 hour). What works fine is Erel's example on the BMP280. Click to expand... Install the dht library to your Arduino IDE - go to sketch -include library - manage libraries and search for DHT, then "more info" and install. Upvote 0
positrom2 said: That's much too early. I just tried some of the DHT examples here, but none worked. They all give the error There are a couple of posts here how to fix it, but I was not able (within 1/2 hour). What works fine is Erel's example on the BMP280. Click to expand... Install the dht library to your Arduino IDE - go to sketch -include library - manage libraries and search for DHT, then "more info" and install.
I inakigarm Well-Known Member Licensed User Longtime User Dec 3, 2016 #4 If you are trying on Esp8266 you should look this post https://www.b4x.com/android/forum/threads/esp8266.65680/page-2#post-428406 The DHT library works fine on Arduino Uno (tested) Upvote 0
If you are trying on Esp8266 you should look this post https://www.b4x.com/android/forum/threads/esp8266.65680/page-2#post-428406 The DHT library works fine on Arduino Uno (tested)
P positrom2 Active Member Licensed User Longtime User Dec 3, 2016 #5 Always same error with those DHT examples here, on UNO, ESP8266 - also with some fixes proposed so far. On Arduino IDE no problem (compiles with UNO). Upvote 0
Always same error with those DHT examples here, on UNO, ESP8266 - also with some fixes proposed so far. On Arduino IDE no problem (compiles with UNO).
I inakigarm Well-Known Member Licensed User Longtime User Dec 3, 2016 #6 I've no computer here to test it; can yo attach log code errors, B4R version and Arduino Ide version? There was some incompatibility issues with some Arduino IDE versions and B4R. Upvote 0
I've no computer here to test it; can yo attach log code errors, B4R version and Arduino Ide version? There was some incompatibility issues with some Arduino IDE versions and B4R.
Erel B4X founder Staff member Licensed User Longtime User Dec 4, 2016 #7 Have you installed the DHT library from Arduino IDE libraries manager? Upvote 0
N newbie Member Licensed User Longtime User Dec 4, 2016 #8 Erel said: Have you installed the DHT library from Arduino IDE libraries manager? Click to expand... Yes, and it works with arduino.ide well i have try the following: --> using rDHTv2 (found in forum) B4R version: 1.50 Parsing code. (0.00s) Compiling code. (0.04s) Building project (0.03s) Compiling & deploying Ino project (Arduino Due (Programming Port) - COM5) Error Konfiguration wird geladen... Pakete werden initialisiert... Boards werden vorbereitet... Überprüfungs- und Hochladevorgang... In file included from sketch\B4RDefines.h:25:0, from sketch\AsyncStreams.cpp:1: sketch\rDht.h:10:4: error: 'dht' does not name a type dht Dht; ^ exit status 1 Fehler beim Kompilieren für das Board Arduino Due (Programming Port). --> rDHTv2 with deleted line "<dependsOn><dht.h></dependsOn>" the same Message as before --> now i have try my well working arduino code via InLine-Code Code: Copy Sub Process_Globals 'These global variables will be declared once when the application starts. 'Public variables can be accessed from all modules. Public DHT1Temp As Float Public DHT1Hum As Float Public DHT1State As String End Sub Sub ReadDHT1Data RunNative("ReadDHT1",Null) End Sub #If C #include "DHT.h" #define DHT1Pin 22 //change here the IO-Pin #define DHT2Pin 24 dht DHT void ReadDHT1(B4R::Object* o) { int chk = dht.read11(DHT1Pin); switch (chk){ case DHTLIB_OK: b4r_dht1state = "OK"; b4r_dht1hum = dht.humidity; b4r_dht1temp = dht.temperature; break; case DHTLIB_ERROR_CHECKSUM: b4r_dht1state = "Checksum error"; b4r_dht1hum = 0; b4r_dht1hum = 0; break; case DHTLIB_ERROR_TIMEOUT: b4r_dht1state = "Time out error"; b4r_dht1hum = 0; b4r_dht1hum = 0; break; default: b4r_dht1state = "Unknown error"; b4r_dht1hum = 0; b4r_dht1hum = 0; break; } } #End If here i get the following message: B4R version: 1.50 Parsing code. (0.00s) Compiling code. (0.02s) Building project (0.02s) Compiling & deploying Ino project (Arduino Due (Programming Port) - COM5) Error Konfiguration wird geladen... Pakete werden initialisiert... Boards werden vorbereitet... Überprüfungs- und Hochladevorgang... b4r_dht.cpp:16: error: expected initializer before 'void' void ReadDHT1(B4R::Object* o) { ^ exit status 1 expected initializer before 'void' Upvote 0
Erel said: Have you installed the DHT library from Arduino IDE libraries manager? Click to expand... Yes, and it works with arduino.ide well i have try the following: --> using rDHTv2 (found in forum) B4R version: 1.50 Parsing code. (0.00s) Compiling code. (0.04s) Building project (0.03s) Compiling & deploying Ino project (Arduino Due (Programming Port) - COM5) Error Konfiguration wird geladen... Pakete werden initialisiert... Boards werden vorbereitet... Überprüfungs- und Hochladevorgang... In file included from sketch\B4RDefines.h:25:0, from sketch\AsyncStreams.cpp:1: sketch\rDht.h:10:4: error: 'dht' does not name a type dht Dht; ^ exit status 1 Fehler beim Kompilieren für das Board Arduino Due (Programming Port). --> rDHTv2 with deleted line "<dependsOn><dht.h></dependsOn>" the same Message as before --> now i have try my well working arduino code via InLine-Code Code: Copy Sub Process_Globals 'These global variables will be declared once when the application starts. 'Public variables can be accessed from all modules. Public DHT1Temp As Float Public DHT1Hum As Float Public DHT1State As String End Sub Sub ReadDHT1Data RunNative("ReadDHT1",Null) End Sub #If C #include "DHT.h" #define DHT1Pin 22 //change here the IO-Pin #define DHT2Pin 24 dht DHT void ReadDHT1(B4R::Object* o) { int chk = dht.read11(DHT1Pin); switch (chk){ case DHTLIB_OK: b4r_dht1state = "OK"; b4r_dht1hum = dht.humidity; b4r_dht1temp = dht.temperature; break; case DHTLIB_ERROR_CHECKSUM: b4r_dht1state = "Checksum error"; b4r_dht1hum = 0; b4r_dht1hum = 0; break; case DHTLIB_ERROR_TIMEOUT: b4r_dht1state = "Time out error"; b4r_dht1hum = 0; b4r_dht1hum = 0; break; default: b4r_dht1state = "Unknown error"; b4r_dht1hum = 0; b4r_dht1hum = 0; break; } } #End If here i get the following message: B4R version: 1.50 Parsing code. (0.00s) Compiling code. (0.02s) Building project (0.02s) Compiling & deploying Ino project (Arduino Due (Programming Port) - COM5) Error Konfiguration wird geladen... Pakete werden initialisiert... Boards werden vorbereitet... Überprüfungs- und Hochladevorgang... b4r_dht.cpp:16: error: expected initializer before 'void' void ReadDHT1(B4R::Object* o) { ^ exit status 1 expected initializer before 'void'
Erel B4X founder Staff member Licensed User Longtime User Dec 4, 2016 #9 You need to add a semicolon after dht DHT. It should also be #include <DHT.h> Upvote 0
N newbie Member Licensed User Longtime User Dec 4, 2016 #10 Erel said: You need to add a semicolon after dht DHT. It should also be #include <DHT.h> Click to expand... Okay, that was a stupid mistake. But there are still other errors that i dont understand: i have the inline-code reduced Code: Copy #If C #include "DHT.h" #define DHT1Pin 22 //change here the IO-Pin #define DHT2Pin 24 dht DHT; void ReadDHT1(B4R::Object* o) { int chk = dht.read11(DHT1Pin); b4r_dht::_dht1hum = dht.humidity; b4r_dht::_dht1temp = dht.temperature; } #End If and get this errors: B4R version: 1.50 Parsing code. (0.00s) Compiling code. (0.04s) Building project (0.02s) Compiling & deploying Ino project (Arduino Due (Programming Port) - COM5) Error Konfiguration wird geladen... Pakete werden initialisiert... Boards werden vorbereitet... Überprüfungs- und Hochladevorgang... sketch\b4r_dht.cpp: In function 'void ReadDHT1(B4R::Object*)': b4r_dht.cpp:17: error: expected primary-expression before '.' token int chk = dht.read11(DHT1Pin); ^ b4r_dht.cpp:19: error: expected primary-expression before '.' token b4r_dht::_dht1hum = dht.humidity; ^ b4r_dht.cpp:20: error: expected primary-expression before '.' token b4r_dht::_dht1temp = dht.temperature; ^ sketch\b4r_dht.cpp: In static member function 'static void b4r_dht::_process_globals()': b4r_dht.cpp:26: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1temp = 0f; ^ b4r_dht.cpp:28: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1hum = 0f; ^ exit status 1 expected primary-expression before '.' token Upvote 0
Erel said: You need to add a semicolon after dht DHT. It should also be #include <DHT.h> Click to expand... Okay, that was a stupid mistake. But there are still other errors that i dont understand: i have the inline-code reduced Code: Copy #If C #include "DHT.h" #define DHT1Pin 22 //change here the IO-Pin #define DHT2Pin 24 dht DHT; void ReadDHT1(B4R::Object* o) { int chk = dht.read11(DHT1Pin); b4r_dht::_dht1hum = dht.humidity; b4r_dht::_dht1temp = dht.temperature; } #End If and get this errors: B4R version: 1.50 Parsing code. (0.00s) Compiling code. (0.04s) Building project (0.02s) Compiling & deploying Ino project (Arduino Due (Programming Port) - COM5) Error Konfiguration wird geladen... Pakete werden initialisiert... Boards werden vorbereitet... Überprüfungs- und Hochladevorgang... sketch\b4r_dht.cpp: In function 'void ReadDHT1(B4R::Object*)': b4r_dht.cpp:17: error: expected primary-expression before '.' token int chk = dht.read11(DHT1Pin); ^ b4r_dht.cpp:19: error: expected primary-expression before '.' token b4r_dht::_dht1hum = dht.humidity; ^ b4r_dht.cpp:20: error: expected primary-expression before '.' token b4r_dht::_dht1temp = dht.temperature; ^ sketch\b4r_dht.cpp: In static member function 'static void b4r_dht::_process_globals()': b4r_dht.cpp:26: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1temp = 0f; ^ b4r_dht.cpp:28: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1hum = 0f; ^ exit status 1 expected primary-expression before '.' token
Erel B4X founder Staff member Licensed User Longtime User Dec 4, 2016 #11 The variable name is DHT not dht. Upvote 0
N newbie Member Licensed User Longtime User Dec 4, 2016 #12 Erel said: The variable name is DHT not dht. Click to expand... OK and what means this ?? sketch\b4r_dht.cpp: In static member function 'static void b4r_dht::_process_globals()': b4r_dht.cpp:26: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1temp = 0f; ^ b4r_dht.cpp:28: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1hum = 0f; ^ exit status 1 unable to find numeric literal operator 'operator"" f' Upvote 0
Erel said: The variable name is DHT not dht. Click to expand... OK and what means this ?? sketch\b4r_dht.cpp: In static member function 'static void b4r_dht::_process_globals()': b4r_dht.cpp:26: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1temp = 0f; ^ b4r_dht.cpp:28: error: unable to find numeric literal operator 'operator"" f' b4r_dht::_dht1hum = 0f; ^ exit status 1 unable to find numeric literal operator 'operator"" f'
Erel B4X founder Staff member Licensed User Longtime User Dec 4, 2016 #13 Have you tried this library: https://www.b4x.com/android/forum/threads/wemos-d1-r2-dht22.68615/#post-435204 ? Change the variables type to Double instead of Float. Upvote 0
Have you tried this library: https://www.b4x.com/android/forum/threads/wemos-d1-r2-dht22.68615/#post-435204 ? Change the variables type to Double instead of Float.
N newbie Member Licensed User Longtime User Dec 4, 2016 #14 Erel said: Have you tried this library: https://www.b4x.com/android/forum/threads/wemos-d1-r2-dht22.68615/#post-435204 ? Change the variables type to Double instead of Float. Click to expand... Hi Erel, thanks, the InLine-Code now works well, the rDHT you have linked give me the following Error: C:\Users\Gerd\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.9\variants\arduino_due_x/variant.h:63:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive] #define digitalPinToPort(P) ( g_APinDescription[P].pPort ) ^ sketch\dht.cpp:121:20: note: in expansion of macro 'digitalPinToPort' uint8_t port = digitalPinToPort(pin); ^ C:\Users\Gerd\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.9\variants\arduino_due_x/variant.h:67:44: error: base operand of '->' is not a pointer #define portInputRegister(port) ( &(port->PIO_PDSR) ) ^ sketch\dht.cpp:122:48: note: in expansion of macro 'portInputRegister' volatile uint8_t *PIR = (volatile uint8_t*)portInputRegister(port); ^ exit status 1 Fehler beim Kompilieren für das Board Arduino Due (Programming Port). Upvote 0
Erel said: Have you tried this library: https://www.b4x.com/android/forum/threads/wemos-d1-r2-dht22.68615/#post-435204 ? Change the variables type to Double instead of Float. Click to expand... Hi Erel, thanks, the InLine-Code now works well, the rDHT you have linked give me the following Error: C:\Users\Gerd\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.9\variants\arduino_due_x/variant.h:63:65: error: invalid conversion from 'Pio*' to 'uint8_t {aka unsigned char}' [-fpermissive] #define digitalPinToPort(P) ( g_APinDescription[P].pPort ) ^ sketch\dht.cpp:121:20: note: in expansion of macro 'digitalPinToPort' uint8_t port = digitalPinToPort(pin); ^ C:\Users\Gerd\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.9\variants\arduino_due_x/variant.h:67:44: error: base operand of '->' is not a pointer #define portInputRegister(port) ( &(port->PIO_PDSR) ) ^ sketch\dht.cpp:122:48: note: in expansion of macro 'portInputRegister' volatile uint8_t *PIR = (volatile uint8_t*)portInputRegister(port); ^ exit status 1 Fehler beim Kompilieren für das Board Arduino Due (Programming Port).
rbghongade Well-Known Member Licensed User Longtime User Dec 5, 2016 #15 Dear friends, I too am having weird behaviour of DHT22 used with rDHT library. Interestingly it worked for quite some time, but recently it stopped working , compiles ok, but reads both temperature and humidity as zero. I am now switching over to inline c code, but wish that the B4R library be fixed. Too much inline C code is shadowing the wonderful B4R code! Upvote 0
Dear friends, I too am having weird behaviour of DHT22 used with rDHT library. Interestingly it worked for quite some time, but recently it stopped working , compiles ok, but reads both temperature and humidity as zero. I am now switching over to inline c code, but wish that the B4R library be fixed. Too much inline C code is shadowing the wonderful B4R code!
rwblinn Well-Known Member Licensed User Longtime User Dec 5, 2016 #16 Hi, tested the rDHT Library v2.00 with a WeMOS D1 and DHT11via serial COM port. Project & Library attached. Arduino IDE 1.6.11 used! Wiring Code: Copy DHT11 ---- ESP8266 WeMOS D1 Wirecolor GND ------ GND black VCC ------ 5v red Signal --- D4 (SDA) yellow Output Code: Copy Humidity = 40 % Temperature =18 Cº Humidity = 40 % Temperature =18 Cº Humidity = 39 % Temperature =19 Cº Humidity = 39 % Temperature =20 Cº Attachments b4rhowtoesp8266dht11.zip b4rhowtoesp8266dht11.zip 5.4 KB · Views: 655 Last edited: Dec 5, 2016 Upvote 0
Hi, tested the rDHT Library v2.00 with a WeMOS D1 and DHT11via serial COM port. Project & Library attached. Arduino IDE 1.6.11 used! Wiring Code: Copy DHT11 ---- ESP8266 WeMOS D1 Wirecolor GND ------ GND black VCC ------ 5v red Signal --- D4 (SDA) yellow Output Code: Copy Humidity = 40 % Temperature =18 Cº Humidity = 40 % Temperature =18 Cº Humidity = 39 % Temperature =19 Cº Humidity = 39 % Temperature =20 Cº
Tayfur Well-Known Member Licensed User Longtime User Dec 5, 2016 #17 rwblinn said: Hi, tested the rDHT Library v2.00 with a WeMOS D1 and DHT11via serial COM port. Project & Library attached. Arduino IDE 1.6.11 used! Wiring Code: Copy DHT11 ---- ESP8266 WeMOS D1 Wirecolor GND ------ GND black VCC ------ 5v red Signal --- D4 (SDA) yellow Output Code: Copy Humidity = 40 % Temperature =18 Cº Humidity = 40 % Temperature =18 Cº Humidity = 39 % Temperature =19 Cº Humidity = 39 % Temperature =20 Cº Click to expand... is it support for DHT22 sensors? Upvote 0
rwblinn said: Hi, tested the rDHT Library v2.00 with a WeMOS D1 and DHT11via serial COM port. Project & Library attached. Arduino IDE 1.6.11 used! Wiring Code: Copy DHT11 ---- ESP8266 WeMOS D1 Wirecolor GND ------ GND black VCC ------ 5v red Signal --- D4 (SDA) yellow Output Code: Copy Humidity = 40 % Temperature =18 Cº Humidity = 40 % Temperature =18 Cº Humidity = 39 % Temperature =19 Cº Humidity = 39 % Temperature =20 Cº Click to expand... is it support for DHT22 sensors?
rwblinn Well-Known Member Licensed User Longtime User Dec 5, 2016 #18 Hi, can not confirm as just ordered a DHT22. Will inform when received the device. Upvote 0
N newbie Member Licensed User Longtime User Dec 6, 2016 #19 rwblinn said: Hi, tested the rDHT Library v2.00 with a WeMOS D1 and DHT11via serial COM port. Project & Library attached. Arduino IDE 1.6.11 used! Wiring Code: Copy DHT11 ---- ESP8266 WeMOS D1 Wirecolor GND ------ GND black VCC ------ 5v red Signal --- D4 (SDA) yellow Output Code: Copy Humidity = 40 % Temperature =18 Cº Humidity = 40 % Temperature =18 Cº Humidity = 39 % Temperature =19 Cº Humidity = 39 % Temperature =20 Cº Click to expand... Hi, it seems there are a some incompatible things between librarie and some boards. I have tested your attached librarie for my Due --> lot of compiler-errors. Same Code tested with an UNO --> works. That makes the confusion. Upvote 0
rwblinn said: Hi, tested the rDHT Library v2.00 with a WeMOS D1 and DHT11via serial COM port. Project & Library attached. Arduino IDE 1.6.11 used! Wiring Code: Copy DHT11 ---- ESP8266 WeMOS D1 Wirecolor GND ------ GND black VCC ------ 5v red Signal --- D4 (SDA) yellow Output Code: Copy Humidity = 40 % Temperature =18 Cº Humidity = 40 % Temperature =18 Cº Humidity = 39 % Temperature =19 Cº Humidity = 39 % Temperature =20 Cº Click to expand... Hi, it seems there are a some incompatible things between librarie and some boards. I have tested your attached librarie for my Due --> lot of compiler-errors. Same Code tested with an UNO --> works. That makes the confusion.
Tayfur Well-Known Member Licensed User Longtime User Dec 6, 2016 #20 rwblinn said: Hi, can not confirm as just ordered a DHT22. Will inform when received the device. Click to expand... thank you for feedback. I am waiting your test results. Upvote 0
rwblinn said: Hi, can not confirm as just ordered a DHT22. Will inform when received the device. Click to expand... thank you for feedback. I am waiting your test results.