diff --git a/README.md b/README.md index f3d84d2..f416183 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,14 @@ The way this works is simple (in theory, not in practice). The Arduino listens f ##board -Right now, the board library will attempt to autodiscover the Arduino. I'm going to make it configurable, don't worry. +````javascript +var board = new arduino.Board({ + device: "ACM" +}); +```` +The 'device' wich arduino is attached on. +Here you can set the exact device (ex. ttyACM0 in my case) or the initial part of it (ex ttyACM) +If this parameter is empty the board library will attempt to autodiscover the Arduino by quering every usb device (not the ttyACM*) ````javascript var board = new arduino.Board({ diff --git a/lib/board.js b/lib/board.js index 770d4c8..55f5197 100644 --- a/lib/board.js +++ b/lib/board.js @@ -12,6 +12,7 @@ var events = require('events'), var Board = function (options) { this.log('info', 'initializing'); this.debug = options && options.debug || false; + this.device = options && options.device || 'usb'; this.writeBuffer = []; var self = this; @@ -71,7 +72,7 @@ util.inherits(Board, events.EventEmitter); Board.prototype.detect = function (callback) { this.log('info', 'attempting to find Arduino board'); var self = this; - child.exec('ls /dev | grep usb', function(err, stdout, stderr){ + child.exec('ls /dev | grep '+ this.device, function(err, stdout, stderr){ var usb = stdout.slice(0, -1).split('\n'), found = false, err = null,