Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andramalech/295a0c7f7ce06e9d055c87f75b85c4b7 to your computer and use it in GitHub Desktop.
Save andramalech/295a0c7f7ce06e9d055c87f75b85c4b7 to your computer and use it in GitHub Desktop.
This is the code that I have in the node which prepares data before it is sent to the Nextion serial protocol.
var str = msg.payload;
var buf = [];
for (var i=0, l = str.length; i < l; i++) {
var ascii = str.charCodeAt(i);
buf.push(ascii);
}
buf.push(255);
buf.push(255);
buf.push(255);
msg.payload = new Buffer(buf);
return msg;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment