• I am simply trying to get the DHT11 to display the temperature in the console of the web IDE through my nodemcu. I'm very new at this, but must be doing something wrong. I modified the code found here: http://www.espruino.com/DHT11 It is constantly returning -1 for both temperature and humidity. If I disconnect everything, it still shows "-1" ...so I'm apparently receiving no data?

    I've tried to get it working in two ways:

    Using "NodeMCU" in the code:

    var dht = require("DHT11").connect(NodeMCU.D1);
    dht.read(function (a) {console.log("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString());});
    

    Declaring pins directly:

    var dht = require("DHT11").connect(D5);
    dht.read(function (a) {console.log("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString());});
    

    Attached is a GPIO reference picture that matches my nodemcu.

    The DHT11 unit I'm using an Osepp DHT11 unit. More info: http://osepp.com/products/sensors-arduin­o-compatible/humidity-temperature-sensor­/

    What am I missing? Do I need some type of resistor in the mix? Have I connected it wrong? This is my first project, an any help you can give me would be greatly appreciated! Thanks!


    1 Attachment

    • nodemcudevkit_v1-0_io.jpg
About

Avatar for greg @greg started