You are reading a single comment by @Gustav and its replies. Click here to read the full conversation.
  • 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})­;
    
    
    
About

Avatar for Gustav @Gustav started