cylon/examples/robot_commands/robot_commands.js

30 lines
448 B
JavaScript

"use strict";
var Cylon = require("../..");
// ensure you install the API plugin first:
// $ npm install cylon-api-http
Cylon.api();
Cylon.robot({
name: "Frankie",
sayRelax: function() {
return this.name + " says relax";
},
work: function(my) {
every((5).seconds(), function() {
console.log(my.sayRelax());
});
},
commands: function() {
return {
say_relax: this.sayRelax
};
}
});
Cylon.start();