var status=0;
var i=0;
function swap() {
i++;
status = !status;
console.log(i,"data",Date().toString());
}
Serial1.on('data', function (data) { swap(); });
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.
Espruino branch: master
try this snippet too: