Commander.io – A Universal Remote Control For Robots and the Internet of Things – Edison - Blink



Commander.io – A Universal Remote Control For Robots and the Internet of Things – Edison - Blink

0 0


preso-mobilecampla-2015


On Github hybridgroup / preso-mobilecampla-2015

Commander.io

A Universal Remote Control For Robots and the Internet of Things

Good Morning

This is #mobilecampla

I am @deadprogram

Ringleader

@hybrid_group

hybridgroup.com

kidsruby.com

The Mobile Internet Of Things

Starring

commander.io

Also starring

cylonjs.com

Full Stack Robotics

Full Stack Robotics?

Edison - Blink

var Cylon = require("cylon");

Cylon.robot({
  name: "edison",
  connections: {
    edison: { adaptor: 'intel-iot' }
  },

  devices: {
    led: { driver: 'led', pin: 13 }
  },

  work: function(my) {
    every((1).second(), function() {
      my.led.toggle();
    });
  }
}).start();

Command Set

{
  "command_set":{
    "name": "Edison Alarm System",
    "type": "list",
    "commands":[
      {
        "label": "Alarm ON",
        "robot": "edison",
        "device": "",
        "name": "turn_on",
        "params": {}
      },
      {
        "label": "Alarm OFF",
        "robot": "edison",
        "device": "",
        "name": "turn_off",
        "params": {}
      }
    ]
  }
}

Edison - Alarm System

var Cylon = require("cylon");

Cylon.api("http", {host: "0.0.0.0", ssl: false});

Cylon.robot({
  name: "edison",
  connections: {
    edison: { adaptor: 'intel-iot' }
  },

  devices: {
    buzzer: { driver: 'led', pin: 4 },
    display: { driver: 'upm-jhd1313m1'}
  },

  writeToScreen: function(message) {
    this.display.setCursor(0,0);
    this.display.write(message);
  },

  turnOn: function() {
    this.buzzer.turnOn();
    this.writeToScreen("Alarm ON");
    return "ok";
  },

  turnOff: function() {
    this.buzzer.turnOff();
    this.writeToScreen("Ready...");
    return "ok";
  },

  commands: function() {
    return {
      turn_on: this.turnOn,
      turn_off: this.turnOff
    };
  },

  work: function() {
    this.writeToScreen("Ready...");
  }
});

Cylon.start();
{
  "command_set":{
    "name": "Edison Alarm System",
    "type": "list",
    "commands":[
      {
        "label": "Alarm ON",
        "robot": "edison",
        "device": "",
        "name": "turn_on",
        "params": {}
      },
      {
        "label": "Alarm OFF",
        "robot": "edison",
        "device": "",
        "name": "turn_off",
        "params": {}
      }
    ]
  }
}

Choose Your Own Hardware Adventure!

To win a Sphero, tweet

@gosphero and @cylonjs

To win a Spark Core, tweet

@spark_io and @cylonjs

Ollie - Spin

var Cylon = require('cylon');

Cylon.api("http", {host: "0.0.0.0", ssl: false});

Cylon.robot({
  name: 'olliebot',
  connections: {
    bluetooth: { adaptor: 'central', uuid: 'cc360e85785e', module: 'cylon-ble'}
  },

  devices: {
    ollie: { name: 'ollie', driver: 'ollie'}
  },

  move: function(direction) {
    var my = this;

    switch (direction) {
      case "up":
        my.ollie.roll(60, 0, 1);
        break;
      case "down":
        my.ollie.roll(60, 180, 1);
        break;
      case "left":
        my.ollie.setRGB(0xFF0000);
        my.ollie.setRawMotorValues(my.ollie.MotorForward, 200, my.ollie.MotorReverse, 200);
        break;
      case "right":
        my.ollie.setRGB(0xFF0000);
        my.ollie.setRawMotorValues(my.ollie.MotorReverse, 200, my.ollie.MotorForward, 200);
    }

    setTimeout(function() {
      my.ollie.setRGB(0x00FFFF);
      my.ollie.stop();
    }, 500);

    return "ok";
  },

  commands: function() {
    return {
      move: this.move
    };
  },

  work: function(my) {
    my.ollie.wake(function(err, data){
      after(200, function() {
        my.ollie.setRGB(0x00FFFF);
      });
    });
  }
}).start();
{
  "command_set":{
    "name": "Olliebot",
    "type": "d-pad",
    "commands":[
      {
        "label": "Up",
        "robot": "olliebot",
        "device": "",
        "name": "move",
        "params":{"direction":"up"}
      },
      {
        "label": "Down",
        "robot": "olliebot",
        "device": "",
        "name": "move",
        "params":{"direction":"down"}
      },
      {
        "label": "Left",
        "robot": "olliebot",
        "device": "",
        "name": "move",
        "params":{"direction":"left"}
      },
      {
        "label": "Right",
        "robot": "olliebot",
        "device": "",
        "name": "move",
        "params":{"direction":"right"}
      }
    ]
  }
}

Was that fun?

Join the Robot Evolution!

commander.io

cylonjs.com

@cylonjs

Thank you!

@deadprogram