Skip to content

Commit

Permalink
port is now manually configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
setola committed Sep 2, 2012
1 parent 5ac9eb7 commit 1dc1277
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -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({
Expand Down
3 changes: 2 additions & 1 deletion lib/board.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1dc1277

Please sign in to comment.