I am using the current release of Espruino together with the Espruino Board v1.4b and I experienced a weird problem with setTimeout() and deep sleep by using the following peace of code:
function perform() {
blink(5000, function() {
setTimeout(function() {
perform();
}, 3600 * 1000);
setDeepSleep(1);
});
};
var blink = function(t, callback) {
var on = false;
var i = setInterval(function() {
on = !on;
digitalWrite(LED2, on);
}, 500);
setTimeout(function() {
digitalWrite(LED2, false);
clearInterval(i);
callback();
}, t);
};
perform();
This code shall let the device blink for 5sec every hour and go into deep sleep mode after blinking. This works for a while and then it suddenly stops blinking without any error being raised or the light is blinking faster with very low power.
The batteries are fully charged. This behaviour can not be reproduced when the device is connected via USB.
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.
Hello everyone,
I am using the current release of Espruino together with the Espruino Board v1.4b and I experienced a weird problem with setTimeout() and deep sleep by using the following peace of code:
This code shall let the device blink for 5sec every hour and go into deep sleep mode after blinking. This works for a while and then it suddenly stops blinking without any error being raised or the light is blinking faster with very low power.
The batteries are fully charged. This behaviour can not be reproduced when the device is connected via USB.
Do you have an idea?
Best,
Tobias