node.js to read usb port signals

后端 未结 2 1530
小鲜肉
小鲜肉 2020-12-31 17:12

I have installed serialport module for node.js using npm.(npm install serialport). Now I would like to send some messages from my android phone

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 17:31

    Why, yes, it's certainly doable. There's a plenty of examples listed at the serialport package homepage itself.

    Your node.js application will start with...

    var SerialPort = require("serialport").SerialPort
    var serialPort = new SerialPort("/dev/tty-usbserial1");
    
    serialPort.on('data', function(data) { /* processing data */ });
    

提交回复
热议问题