• On the master, it's just:

    USB.setConsole(true); // make sure console stays off Serial1
    var line = "";
    Serial1.on('data', function(d) {
      line += d;
      i= line.indexOf("\n");
      while (i>=0) {
        console.log(line.substr(0,i)); // do stuff with data
        line = line.substr(i+1);
        i = line.indexOf("\n");
      }
    });
    

    And on the slave, make sure echo(0) is set to avoid the console outputting a load of extra control characters, then just call console.log(..) to return the data you want.

About

Avatar for Gordon @Gordon started