Replies: 1 comment
-
Exactly the same problem for me too ! Spent 10 hours so far finding any solution. Nothing helps. Here is the code of the old node-red-node-arduino module I'm trying to upgrade: const { SP } = require('serialport'); // changed format SP -> to {SP} at v9 => v10.
RED.httpAdmin.get("/arduinoports", RED.auth.needsPermission("arduino.read"), function(req, res) {
SP.list().then(
ports => {
const a = ports.map(p => p.comName);
res.json(a);
this.log(c_fbr + "Serial ports list:", a);
},
err => {
this.error(c_fbr + "Error listing serial ports", err);
}
);
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In earlier versions of "serialport" i was able to easily parse a list of serial ports to detect a specific device, see code below.
However from version 10 it is noted that "SerialPortStream from @serialport/stream no longer has a list() method as that was a direct call to the bindings"
There are lots of references to this on the web but for the life of me i cant fine a complete example and be able to search through the ports and open one for the device I want.
Does anyone have an example they could share?
Beta Was this translation helpful? Give feedback.
All reactions