var SerialPort = require("serialport"); //
var portName = "COM5"; //
var serialPort = new SerialPort(
"COM5", {
baudRate: 9600, //
dataBits: 8, //
parity: "none", //
stopBits: 1, //
flowControl: false
}, false);
serialPort.open(function (error) {
if (error) {
console.log("" + portName + ":" + error);
} else {
console.log("");
}
})
error:
serialport.close() ;