node.js serialport在Windows上没有打开端口

时间:2017-02-20 11:24:07

标签: node.js serial-port node-serialport

var SerialPort = require("serialport");
var port = new SerialPort("COM5");

port.on('open', function() {
  port.write('main screen turn on', function(err) {
    if (err) {
      return console.log('Error on write: ', err.message);
    }
    console.log('message written');
  });
});

// open errors will be emitted as an error event 
port.on('error', function(err) {
  console.log('Error: ', err.message);
})
install npm -g serialport 
install npm serialport
  

错误:打开COM5:未知错误代码121

0 个答案:

没有答案