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.
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!
Search Options
Types to Display
Espruino
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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:
Declaring pins directly:
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-arduino-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!