Online Mbed compiler, DHT11

Hi, I’m using the mbed online compiler and trying to make the DHT 11 (Temp and Humidity Sensor) to work, as I compile the program I keep getting an error tha says “use of undeclared identifier Open Drain”

Hello,

please be so kind and share a link to the program what you use.
In the Mbed components you can find - Grove Temperature & Humidity Sensor | Mbed

BR, Jan

Hi,

Yes here is the link, DHT11 - A library for the use of DHT11, a temperature and… | Mbed

BR, Victor

Hello,

can you share info about the board and MbedOS version what did you use? Because I did not encounter an error about “use of undeclared identifier Open Drain”.

Below are updated versions for MbedOS6+
DHT11 - Fork of https://os.mbed.com/users/s_inoue_mbed/co… | Mbed
DHT - Fork of DHT component - https://os.mbed.com/teams… | Mbed
These were not tested on real hardware for now so please let me know.

BR, Jan

Hi,

I am new to Mbed so I dont know if I did any mistakes on the code or I didn’t declare a variable, I will upload images of the errors I am getting. the board I am using is the FRDM K64F/


BR, Victor

Hello,

it seems it is not your fault, but your board not have supported (or implemented) OpenDrain PinMode.
For compare with another board:

Try to use the second library.

BR, Jan

Hi,

Do you mind guiding me through on how to add the second library?

Regards,
Victor

Try to import this example - Seeed_Grove_Temp_Humidity_Example - Temp and Humidity sensor example. DHT11 | Mbed
Right click on mbed library in your project (gear wheel) and choose Update and change pin name in the constructor of the DHT object, if you needed.
You will see if it will work.

BR, Jan

I came here because I am getting the same error. importing any of these libraries do not work in any way. I have imported every example for the DHT11 and none work.

Hello,

Do you mean the same error from above?

“use of undeclared identifier Open Drain”

Could you share your target, MbedOS version and tool please?

BR, Jan

In my case, it was named D3. I am using an ST L476RG and the most current Keil Studio on both the online and installed IDE. I am not sure what you mean by “tool.” In the library, there are two errors. One is for the header file. The error is pertaining to a deprecated feature of C++. Etypes for enums cannot be used any longer. I am a student and learning C++. I cannot seem to find what is used or how to fix the header file for that. The second error is the same as this one. Doesn’t matter what I put inside “sensor(x, y)”. It throws this error.

I had in mind a build tools like MbedStudio, Keil Studio, Online compiler and so on.
But I am still missing information about MbedOS version, could you fill?

According to your description of errors it seems like you use the old library what is not compatible with MbedOS6+. So I suppose you use MbedOS6+. If I am right then you miss my post above.

I tried the DHT library with DHT11 sensor on Nucleo-F429ZI with MbedOS6.16 and builded with Keil Studio Cloud.
The test code is included in .h file, but careful some printf settings must be changed becasue of float data type.

Result is:

Temperature in Kelvin: 299.15, Celcius: 26.00, Farenheit 78.80
Humidity is 47.00, Dewpoint: 13.84, Dewpoint fast: 13.80
Temperature in Kelvin: 299.15, Celcius: 26.00, Farenheit 78.80
Humidity is 47.00, Dewpoint: 13.84, Dewpoint fast: 13.80

What was changed in the library is visible in history, nothing special.

BR, Jan