Answer the question
In order to leave comments, you need to log in
How to work with native cctalk parser in node serial?
I'm trying to use node serial and the native cctalk parser to start a kyupurnik that works on cctalk.
I'm trying to send a command from an example via cctalk TX data = 2 0 1 245 8
const SerialPort = require("serialport");
const CCTalk = require('@serialport/parser-cctalk')
let port = new SerialPort("/dev/ttyUSB0", {
autoOpen: false
});
const parser = port.pipe(new CCTalk())
parser.on('data', console.log)
port.open((err) => {
if (err) {
return console.log("Error opening port: ", err.message);
} else {
console.log('port has ben opened')
port.write(Buffer.from("2012458", "hex"), function(err){
if(err) console.log('writing error: ', err)
})
}
});
port.on("data", (data) => {
console.log('data => ', data)
})
port.on("error", function(err) {
console.log('Error: ', err.message)
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question