On Github hybridgroup / preso-mobilecampla-2015
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":{ "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": {} } ] } }
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": {} } ] } }
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"} } ] } }