Send byte (0xFF) with Node.js through SerialPort
<p>I send command with an ending byte, it's : 0xFF three times. In python, this code is working :</p>

<pre><code>import time
import serial

ser = serial.Serial(
  port='/dev/ttyAMA0',
  baudrate = 9600,
  parity=serial.PARITY_NONE,
  stopbits=serial.STOPBITS_ONE,
  bytesize=serial.EIGHTBITS,
  timeout=1
)

while 1:
  EndCom = "\xff\xff\xff"
  ser.write('page 1'+EndCom)
  print EndCom
  time.sleep(1)
</code></pre>

<p>The same code in Node.js doesn't working :</p>

<pre><code>var serialport = require('serialport');
var SerialPort = serialport.SerialPort;

var port = new SerialPort('/dev/ttyAMA0', {
  baudrate: 9600
});

port.on('open', function() {
  console.log('Port ouvert sur /dev/ttyAMA0 @ 9600 bds');

  var end = "\xff\xff\xff";
  port.write("page 1"+end);
});

port.on('data', function(byte) {
  console.log("Data :", byte.toString('hex').match(/.{1,2}/g).join(" "));
});
</code></pre>

<p>I use this to control a Nextion Screen that is work with SerialPort. With Python i receive "page 1   " with 3 spaces, with Node.js i receive this : "page 1Ã¿Ã¿Ã¿".</p>

<p>I don't know why, there isn't any difference to me.</p>

<p>Thanks for the help !</p>