你好,我尝试连接串行端口的缓冲区(rflink)
myport.on('data', (data) => {
console.log(data)})
我收到了
<Buffer 32 30>
<Buffer 3b 30 30 3b 4e 6f 64 6f 20 52 61 64 69 6f 46 72 65 71 75 65 6e 63 79 4c>
<Buffer 69 6e 6b 20 2d 20 52 46 4c 69 6e 6b 20 47 61 74 65 77 61 79 20 56 31 2e>
<Buffer 31 20 2d 20 52 34 38 3b 0d 0a>
或者我希望有 1 行而不是 N 行
我一直在努力
var receiveData = '';
myport. on (' data', (data) => {
receiveData += data
console.log(receiveData)}
我收到
20;00;Nodo RadioFr
20;00;Nodo RadioFrequencyLink - RFLink Gat
20;00;Nodo RadioFrequencyLink - RFLink Gateway V1.1 - R48;
我的串口配置如下
myport = new serialport(com, {
baudRate: 57600,
databits: 8,
parity: 'none',
stopBits: 1,
buffersize : 4096,
flowControl: false,
parser: new serialport.parsers.Readline('\n\r')
我只是想收到
20;00;Nodo RadioFrequencyLink - RFLink Gateway V1.1 - R48;
有人可以帮我吗?请
最佳答案
你必须这样做
console.log(data.toString())
了解有关缓冲区对象的更多信息
关于javascript - 连接缓冲区串口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47673758/