Skip to content

Instantly share code, notes, and snippets.

@oriolrius
Created July 4, 2018 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save oriolrius/46aa6f723ae62c6a0e8c4e6ea8a69bae to your computer and use it in GitHub Desktop.
Save oriolrius/46aa6f723ae62c6a0e8c4e6ea8a69bae 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