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.
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.
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.
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
B4X:
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'
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'
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).
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!
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.