Node.js
var SerialPort = require("serialport"), serialPort; SerialPort.list(function(err, ports) { ports.forEach(function(port) { if (port.manufacturer && /arduino/.test(port.manufacturer.toLowerCase())) { serialPort = new SerialPort(port.comName, { baudRate : 9600 }); serialPort.on("open", main); } }); }); function main() { console.log(this); }
接続しているArduinoが1台であればこれでOKそうです。