But what I tend to do is handle a line at a time, which I think is easier?
var line = "";
SerialX.on('data', function(s) {
line += s;
var i = line.indexOf("\n");
while (i>=0) {
handleLine(line.substr(0,i));
line = line.substr(i+1);
i = line.indexOf("\n");
}
});
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.
Well, there's:
But what I tend to do is handle a line at a time, which I think is easier?