Last active
February 18, 2016 01:10
-
-
Save raskaman/2c19962cdb8dd1fb977e to your computer and use it in GitHub Desktop.
Johnny Five
This file contains hidden or 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
var five = require("johnny-five"); | |
var board = new five.Board(); | |
board.on("ready", function() { | |
var led = new five.Led(13); | |
led.blink(500); | |
}); |
This file contains hidden or 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
'use strict'; | |
var VirtualSerialPort = require('udp-serial').SerialPort; | |
var firmata = require('firmata'); | |
var five = require("johnny-five"); | |
//create the udp serialport and specify the host and port to connect to | |
var sp = new VirtualSerialPort({ | |
host: '192.168.4.1', | |
type: 'udp4', | |
port: 1025 | |
}); | |
//use the serial port to send a command to a remote firmata(arduino) device | |
var io = new firmata.Board(sp); | |
io.once('ready', function(){ | |
console.log('IO Ready'); | |
io.isReady = true; | |
var board = new five.Board({io: io, repl: true}); | |
board.on('ready', function(){ | |
console.log('five ready'); | |
//Full Johnny-Five support here: | |
var led = new five.Led(13); | |
led.blink(500); | |
}); | |
}); |
This file contains hidden or 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
{ | |
"name": "testled", | |
"version": "0.0.1", | |
"dependencies": { | |
"johnny-five": "latest" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment