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.
setDeepSleep(1);
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);
@Gordon 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.
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: