Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@raskaman
Last active February 18, 2016 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raskaman/2c19962cdb8dd1fb977e to your computer and use it in GitHub Desktop.
Save raskaman/2c19962cdb8dd1fb977e to your computer and use it in GitHub Desktop.
Johnny Five
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var led = new five.Led(13);
led.blink(500);
});
'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);
});
});
{
"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