Yes, I'd always buffer it. I think it's pretty common practice to just use the newline character:
function handleLine(l) {...}
function setup() {
Serial2.setup(115200);
var line="";
Serial2.on('data', function (str) {
var l = (line+str).split("\n");
line = l.pop();
l.forEach(handleLine);
});
};
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.
Yes, I'd always buffer it. I think it's pretty common practice to just use the newline character: