Created
April 30, 2015 15:47
-
-
Save deadprogram/39a4c7e878e22c746c07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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