Use Octoblu to control an LED on your favorite Arduino board

Connect your Arduino to your machine and install standard firmata on your Arduino using the Arduino IDE. Then:

npm install johnny-five

Create an "index.js" file with the code below:

var five = require('johnny-five'), led;
var meshblu = require('meshblu');

var conn = meshblu.createConnection({
    "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "token": "yyyyyyyyyyyyyyyyyyyyyyyy"
});

conn.on('ready', function(data){
    console.log('Connected to Octoblu');
    five.Board().on('ready', function(){
        led = new five.Led(13);
        console.log('Board ready');
        conn.on('message', function(data){
            console.log('message received', data);
            if(data.payload.led == true){
                led.on();
            } else {
                led.off();
            }
        });
    });
});

Then open our JS Console. You can interact with your new Node.js app by typing these commands in your browser's developer console:

// Turn LED on
conn.message({
    "devices": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "payload": {"led": true}
});

// Turn LED off
conn.message({
    "devices": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "payload": {"led": false}
});