I inakigarm Well-Known Member Licensed User Longtime User Apr 21, 2016 #1 I've tried to wrap DTH library to read Temperature and Humidity of an inexpensive DHT11 sensor Spoiler: DHT11 DHT11 First, I've tried to wrap the Dht class and one method (read11 and it works) but I can't configure how to obtain the humidity and temperature parameters (I've no experience on C and I suppose is a syntax problem) I attached the original library and the wrapper; anybody can help me doing the wrapper? Thanks Attachments dht.zip dht.zip 3.8 KB · Views: 812
I've tried to wrap DTH library to read Temperature and Humidity of an inexpensive DHT11 sensor Spoiler: DHT11 DHT11 First, I've tried to wrap the Dht class and one method (read11 and it works) but I can't configure how to obtain the humidity and temperature parameters (I've no experience on C and I suppose is a syntax problem) I attached the original library and the wrapper; anybody can help me doing the wrapper? Thanks
Erel B4X founder Staff member Licensed User Longtime User Apr 22, 2016 #2 Change the signature to: Double GetHumidity(); in the cpp file: Double B4RDht::GetHumidity(){ return Dht.humidity; } Another option is to make it a property. This will happen if you change the name to getHumidity instead of GetHumidity. BTW, you should always use Double instead of double. Otherwise there will be compiler errors when you compile to Arduino Due.
Change the signature to: Double GetHumidity(); in the cpp file: Double B4RDht::GetHumidity(){ return Dht.humidity; } Another option is to make it a property. This will happen if you change the name to getHumidity instead of GetHumidity. BTW, you should always use Double instead of double. Otherwise there will be compiler errors when you compile to Arduino Due.