I thought this could have been bad hardware but then when I tried the same device on Arduino IDE (with all the exact same hardware setup) it worked fine. For the Arduino IDE I used this module and that works fine: DFRobot_DHT11.h https://github.com/DFRobot/DFRobot_DHT11
I bought some of these https://www.amazon.co.uk/gp/product/B09Z2B6LVP/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1 and tried them with this module. However, no matter what I did I kept getting null.
Here's the code I've been using:
But the value is always null.
I also tried
but that's also always null.
I thought this could have been bad hardware but then when I tried the same device on Arduino IDE (with all the exact same hardware setup) it worked fine. For the Arduino IDE I used this module and that works fine: DFRobot_DHT11.h https://github.com/DFRobot/DFRobot_DHT11