You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I think your problem is that you are still connected to WiFi - while the microcontroller itself can draw very little power, WiFi still takes a lot.

    Also, setDeepSleep(1); can't be used when there's a WiFi connection as it stops the UART from working correctly.

    How about:

    function finished() {
      wifi.disconnect();
      setDeepSleep(1);
    }
    function newCycle() {
      setDeepSleep(0);
      wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
        if (err) { 
          finished();
          return;
        }
        HTTP.get("http://192.168.1.121:1880/esprĀ­uino?Temp=24", function(res) {
          res.on('data', function(data) {
            console.log(data);
          });
          res.on('close', function(data) {
            console.log("HTTP got close.");
            finished();
          });
          res.on('error', function(data) {  // timeout not trapped 
            console.log("HTTP error.");
            finished();
          });
        });
      });
    }
    setInterval(newCycle, 20000);
    
About

Avatar for Gordon @Gordon started