Trying to read humidity and temp in a jar. Worked 20 minutes ago, but now all I get is:
{ "err": true, "checksumError": false, "raw": "", "temp": -1, "rh": -1 } Temp is -1 and RH is -1
Any thoughts ? Sensor hookup: Gnd = Gnd , Vcc = D1, DATA = D2
My code:
setWatch (function(){ digitalWrite(D1, 1); var dht = require("http://www.espruino.com/modules/DHT11.js").connect(D2); dht.read(function (a) { console.log(a); console.log("Temp is "+a.temp.toString()+" and RH is "+a.rh.toString()); if (a.rh > 70) { digitalPulse(LED1, 1, [2000]); } if (a.rh >= 60 && a.rh <= 70) { digitalPulse(LED3, 1, [2000]); } if (a.rh < 60 && a.rh != -1) { digitalPulse(LED2, 1, [200, 100, 200, 100, 200, 100, 200, 100, 200]); } if (a.rh === -1) { digitalPulse(LED1, 1, [200, 100, 200, 100, 200, 100, 200, 100, 200]); } }); setTimeout(function() { digitalWrite(D1, 0); }, 7000); }, BTN, { edge:"falling",repeat:true,debounce:50});
@Gustav started
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.
Trying to read humidity and temp in a jar. Worked 20 minutes ago, but now all I get is:
Any thoughts ?
Sensor hookup: Gnd = Gnd , Vcc = D1, DATA = D2
My code: