My Experience Programming Robots in NodeJS

// Jul 25, 2015

Today I attended NodeSchoolYVR over at the Zillow headquarters in Yaletown, Vancouver; and man was it the best programming experience I’ve had in a while. The last time I was this amazed was when I first learnt React.

The topic of interest was programming hardware with JavaScript (basically building robots to take over the world), using an amazing JavaScript robotics library called johnny-five.

The whole experience was fantastic and it’s amazing how one simple snippet of JavaScript code such as the one below can make hardware do such amazing things:

var sys = require("sys");
var exec = require('child_process').exec;
var five = require('johnny-five');
var board = new five.Board();

function puts(err, stdout, stderr) { sys.puts(stdout) };

board.on('ready', function() {
  console.log("board ready");
  var button = new five.Button(5);
  var led = new five.Led(9);

  button.on("press", function() {
    exec("say its party time", puts);
    led.strobe(100);
  });
});


Here’s a quick highlight of the awesome stuff we built in just 3 hours of learning the Johnny-Five library:

A robot fan for a hot summer day:

It got too hot so I programmed a fan to keep us cool #nodeschoolinternational #nodeschool #robots #javascript

A video posted by Johnny Ji (@johnnyisji) on



Building a party robot:

I'm calling him "Partybot" #nodeschoolinternational #nodeschool

A video posted by Johnny Ji (@johnnyisji) on



Not a day goes by where I’m not absolutely amazed by the power of JavaScript! Until next time.