Getting started with johnny-five
|Johnny-five is a java script frame work which allows nodejs apps to talk to the hardware such as Arduino ,Intel Edison and Raspberry Pi. For full list of support platforms ,look here
In this blog, we will see how to use Arduino uno with johnny-five. Johnny-five is a javascript lib,it requires nodejs to run. So we need a host machine to Johnny-five. Johnny-five will talk to the Arduino over serial and controls different peripherals of arduino.
johnny-five uses standard firmata to control the arduino, we need load the firmata sketch to arduino. Connect arduino uno to system and open arduino IDE.
File->Examples->Firmata->StandardFirmata
Upload the sketch to uno,once done you can close the IDE, now arduino is ready to accept commands over serial line.
We need to have nodejs, if your system doesn’t have it,please install from here.
to install johnny-five open cmd prompt and run
npm install johnny-five
open a file in the same directory and copy the following code. the code makes the on board led to blink (pin 13)
var five = require("johnny-five"); var board = new five.Board(); board.on("ready", function() { var led = new five.Led(13); led.blink(500); });
you can find more examples on here.