Ok, thanks - and it's literally just this code and nothing else:
var busy = false;
var gatt;
setInterval(function() {
console.log("Trying to connect...");
if (!busy) {
busy = true;
NRF.connect("xx:xx:xx:xx:xx:xx random").then(function(g) {
gatt = g;
return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
}).then(function(s) {
return s.getCharacteristic("6e400002-b5a3-f393-e0a9-e50e24dcca9e");
}).then(function(c) {
return c.writeValue("o()\n");
}).then(function() {
busy=false;
if(gatt !== undefined)gatt.disconnect();
console.log("Write value success!");
}).catch(function(e) {
busy=false;
if(gatt !== undefined)gatt.disconnect();
console.log("Write value error. ", e);
});
} else {
console.log("Device is busy!");
}
},1000);
Because that error means that the Puck has run out of memory - so if it's the code above it'll be a memory leak in Puck.js, but if it's other code it could just be that you're storing a bunch of data somewhere?
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.
Ok, thanks - and it's literally just this code and nothing else:
Because that error means that the Puck has run out of memory - so if it's the code above it'll be a memory leak in Puck.js, but if it's other code it could just be that you're storing a bunch of data somewhere?