Created
July 4, 2018 16:03
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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