You are reading a single comment by @oesterle and its replies. Click here to read the full conversation.
  • I'd try breaking sendForm() and bh.read() out of the dht.read() callback. Not sure if that will help, but it might relieve some memory shortage. Untested code:

    // global vars up near the top
    var lastTemp = "";
    var lastHumidity = "";
    var lastLight = "";
    
    function sendSensorData(){
       sendForm(lastTemp, lastHumidity, lastLight);
    }
    
    // ........
    // further down, in place of your setInterval() section
    
    setInterval(function() {
      lastLight = Math.round(bh.read()).toString();
      dht.read(function (a) {
        lastTemp = a.temp.toString();
        lastHumidity = a.rh.toString();
    
        // let's give Espruino an opportunity to do housekeeping
        // before sending our form
        setTimeout(sendSensorData, 5000);
      });
    }, 60000); // once a minute
    
    
    
    
About

Avatar for oesterle @oesterle started