• 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);
      });
    };
    
    
About

Avatar for Gordon @Gordon started