For this part of code for my node.js server
var SerialPort = require("serialport");
var port = new SerialPort("/dev/tty-usbserial1", {});
which use the https://github.com/EmergingTechnologyAdvisors/node-serialport library.
How I can know this path to my serial port?
I tried the previous answers in this question but they did not work in latest version of serial port (Sept 2020). We need to use serialport.list()
function in promise approach like this:
const SerialPort = require('serialport')
SerialPort.list().then(ports => {
ports.forEach(function(port) {
console.log(port.path)
})
})
I hope this will help you to solve this problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With