-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Board: emit a "connect" event when transport opens; set isReady = true
- Loading branch information
Showing
4 changed files
with
95 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var SerialPort = require("serialport"); | ||
var five = require("johnny-five"); | ||
var Firmata = require("../"); | ||
|
||
SerialPort.list(function(error, list) { | ||
var device = list.reduce(function(accum, item) { | ||
if (item.manufacturer.indexOf("Arduino") === 0) { | ||
return item; | ||
} | ||
return accum; | ||
}, null); | ||
|
||
|
||
/* | ||
The following demonstrates using Firmata | ||
as an IO Plugin for Johnny-Five | ||
*/ | ||
|
||
var board = new five.Board({ | ||
io: new Firmata(device.comName) | ||
}); | ||
|
||
board.on("ready", function() { | ||
var led = new five.Led(13); | ||
led.blink(500); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters