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.
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.
On the master, it's just:
And on the slave, make sure
echo(0)
is set to avoid the console outputting a load of extra control characters, then just callconsole.log(..)
to return the data you want.