DHT sketch version 2.0.0 error [solved]



  • @hek: I started with using the new DHT sketch (v1.1) from git. When opening the sketch in Visual Studio, it reports an error on: dht.readSensor(true); apperently this is not an allow function from the DHT library. The error message is:
    0_1472478369956_upload-1cbe1423-c289-4903-83ea-5bcb64391554

    I used the DHT library form mysensors Git.

    Do you have any suggestions on this?

    Thx

    Ralph


  • Mod

    @bisschopsr the readSensor function is available in the DHT library in MySensors git:
    https://github.com/mysensors/MySensorsArduinoExamples/blob/e97ae9e2df18e29cb9dc3c4f5945795b7baca6a9/libraries/DHT/DHT.h#L62

    The error message says that the function is declared on line 83, which is different from line 62.

    Maybe you have more than one version of the DHT library installed?



  • @mfalkvidd: No, I only have one, I double checked. But you are write about the DHT lib, that is where it is going wrong. I see that you are looking in the branch itself, The version I used is from the ZIP (at the bottom of the read-me) That version differs a lot:

    82  protected:
    83  void readSensor();
    84
    85  float temperature;
    86 float humidity;
    

    That is where the error is, different version in the referenced ZIP. Confusing and put me on the wrong track :-(.

    Thx
    Ralph


  • Mod

    @bisschopsr good observation. We should probably fix the readme so we avoid confusing more people. Which readme are you referring to? I'm unable to fina a zip reference in https://github.com/mysensors/MySensorsArduinoExamples and https://github.com/mysensors/MySensors



  • @mfalkvidd This one: https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/DHT at the bottom is installation with a link to a ZIP file called DHT, this downloads the libray files.

    Thx for the help by the way. Much appreciated!

    Regards,
    Ralph


  • Mod

    @bisschopsr ah, that one. That's a bit hard to fix, unfortunately.

    I don't think the MySensors project should modify it, since it belongs to the DHT library. The DHT library readme suggests that you use the latest version of the library, available from their github repository. That is expected.

    But the latest version of the DHT library has some changes. It is for example missing the public function the MySensors example is using, as you noticed, which breaks the example. That's why MySensorsArduinoExamples includes the required libraries, which "correct" versions.

    The right way to use MySensorsArduinoExamples is to download the MySensorsArduinoExamples zip file from https://github.com/mysensors/MySensorsArduinoExamples. That zip file includes all libraries, so there is no need to fetch them from somewhere else.

    Dependency management is messy, unfortunately.



  • @mfalkvidd I agree, it's always difficult if your solution depends on external libraries. However if we use a modified version of DHT in our MySensors, we should not call it DTH, but something like MyDHT. That makes it specific for MySensors. Currently the risk is that a DHT library is in the library directory that is not standard, other sketches (non MySensors) might break on it.

    I did download the full set you suggested already and applied it. The error is now gone. Now for me to sort out why radio's are not communicating, but that is off topic...

    Ralph


  • Mod

    @bisschopsr MySensors does not use a modified version of DHT. MySensors is using an old version, since the new version isn't compatible (they have removed at least one public function).

    Edit: I was wrong. MySensors have made a private function public, without upstreaming the change.



  • @mfalkvidd Aha clear, but the mismatch stays the same, isn't it? Anyway lets close this thread, DHT is running now, so I'm happy :-).



  • @bisschopsr
    hi , i have some problem . i download https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/DHT and install this but there is error in line : dht.readsensor(true);



  • @Reza Hi Reza, sorry for the little delay in replying. Anyway, read the response of @mfalkvidd 4 steps up. He gives the link for the correct library. If that does not work, there might be another problem with your libraries. Did you check if you really are using the correct one. Sometimes the old one is persistent, so you think you have the correct one, but in practice you don't. Compare the one you have downloaded with the one in your IDE to be sure.

    Ralph



  • @bisschopsr said:

    Hi Reza, sorry for the little delay in replying. Anyway, read the response of @mfalkvidd 4 steps up. He gives the link for the correct library. If that does not work, there might be another problem with your libraries. Did you check if you really are using the correct one. Sometimes the old one is persistent, so you think you have the correct one, but in practice you don't. Compare the one you have downloaded with the one in your IDE to be sure.

    thank you for answer , but this is dont solve for me :(



  • @Reza Ok, and you did check the library compiled with your sketch is the correct one? the error is exactly the same as I had, so it really looks like you are using a different library. This is a tricky thing, so please check. What IDE are you using?



  • @bisschopsr
    arduino 1.6.8



  • Hi @bisschopsr
    I got this error when i'm using this lib
    0_1476722804472_upload-fff536fa-e6c8-498c-b881-e4a96da10b64

    Any Idea. I'm using IDE 1.6.12. new install and Installed Mysensor through the Manage library. My sensor is working (updated my gw and other sensors, but can't upgrade my DHT sensors.
    Thanx for your help


  • Admin

    @clio75
    Just a warning. Just ignore it and be happy. ;)


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.