Pew Pew Laser Blog

Code. Glass art. Games. Baking. Cats. From Seattle, Washington and various sundry satellite locations.

Pew Pew Laser Blog Archives — by Blog ID

Johnny-Five on tinylab.

8.17.2016

I got my tinylab last week; it's a nifty little prototyping board with an Arduino Leonardo and a bunch of embedded components that was funded on IndieGoGo. So naturally I wanted to get Johnny-Five working and start fiddling with the tinylab as soon as possible. Unfortunately, it seems like the hardest part of every hardware project is the grand upgrading of the softwares that must proceed fiddling. Here's the process that worked for me.

  1. Re-install Node. My Node installation was a few versions old, and somehow npm was missing. So I went ahead and installed Node.js from https://nodejs.org/en/download/. I decided to live dangerously and install the "Current" version rather than the Stable one.
  2. Upgrade Arduino.app. My Arduino install was older than the Leonardo, so I needed to upgrade it too. I got version 1.6.10 from https://www.arduino.cc/en/Main/Software.
  3. Upgrade npm packages. npm outdated showed that several packages (including Johnny Five) were out of date. This required a few rounds of npm update.
  4. Write the Johnny Five code. I checked the excellent Johnny Five docs and wrote this code for the first LED on the tinylab.
    var five = require("johnny-five");
    var board = new five.Board();
    
    board.on("ready", function(){
      var led = new five.Led(13);
      led.pulse(1000);
    });
    This should make LED1 (on pin D13) pulse on an off. At first I tried using "D13" to address the LED (since that's what's silk-screened on the board) but it was just 13 that worked.

Success!

Here is some tinylab documentation that might come in handy next time:

Permalink

Tags: code johnny-five maker node nodebots

Authorized users may log-in to leave a comment.

Last Blog: Interviewing a Front-End Developer.

Next Blog: How I Got Involved With CascadiaFest.