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

Arduino blinking led

Arduino blinking led

 

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 with UNO

johnny-five with UNO

 

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

uploading firmata to arduino uno

uploading firmata to arduino uno

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

jf_install

open a file in the same directory and copy the following code. the code makes the on board led to blink (pin 13)

johnny-five_uno_led


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.

Add a Comment

Your email address will not be published. Required fields are marked *