Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created April 30, 2015 15:47
Show Gist options
  • Save deadprogram/39a4c7e878e22c746c07 to your computer and use it in GitHub Desktop.
Save deadprogram/39a4c7e878e22c746c07 to your computer and use it in GitHub Desktop.
"use strict";
var Cylon = require("cylon");
// ensure you install the API plugin first:
// $ npm install cylon-api-http
Cylon.api("http", {
host: "0.0.0.0", port: 3000, ssl: false,
auth: {
type: 'basic',
user: 'admin',
pass: 'passme'
}
});
Cylon.robot({
name: "test",
commands: function() {
var that = this;
return {
hello: that.hello
};
},
connections: {
loopback: { adaptor: "loopback" }
},
devices: {
ping: { driver: "ping" }
},
hello: function() {
console.log("Hello");
},
work: function(my) {
every((1).seconds(), function() {
console.log("Hello, human!");
console.log(my.ping.ping());
});
after((5).seconds(), function() {
console.log("I've been at your command for 5 seconds now.");
});
}
});
Cylon.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment