I'm considering removing Serial.onData and moving to a more coherent node.js-like API. Your code would have been:
Serial1.onData(function(e) {
doStuff(e.data); // single character
});
And I'd like to change to:
Serial1.on('data', function(chars) {
doStuff(chars); // maybe >1 character
});
I know this will break some stuff, but it'll be faster and more efficient. I'm also planning on adding some stuff at the same time so you'll be able to pipe Serial to other devices (such as files).
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.
I'm considering removing
Serial.onData
and moving to a more coherent node.js-like API. Your code would have been:And I'd like to change to:
I know this will break some stuff, but it'll be faster and more efficient. I'm also planning on adding some stuff at the same time so you'll be able to pipe Serial to other devices (such as files).
What does everyone think?