Arm Mbed OS support forum

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