serialport-v5
Version:
fork with electron support of Node.js package to access serial ports. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!
17 lines (14 loc) • 396 B
JavaScript
;
// outputs the path to an arduino or nothing
const serialport = require('../');
serialport.list()
.then(ports => ports.find(port => /arduino/i.test(port.manufacturer)))
.then(port => {
if (!port) { throw new Error('Arduino Not found') }
console.log(port.comName);
})
.catch((err) => {
console.error(err.message);
process.exit(1);
});