cylon/examples/hello/hello.js

33 lines
554 B
JavaScript
Raw Permalink Normal View History

2014-12-14 08:19:25 +08:00
"use strict";
var Cylon = require("../..");
// ensure you install the API plugin first:
// $ npm install cylon-api-http
2014-08-08 04:44:25 +08:00
Cylon.api();
Cylon.robot({
2014-12-14 08:19:25 +08:00
name: "test",
2014-11-26 06:39:24 +08:00
2014-11-26 08:01:31 +08:00
connections: {
2014-12-14 08:19:25 +08:00
loopback: { adaptor: "loopback" }
2014-11-26 08:01:31 +08:00
},
devices: {
2014-12-14 08:19:25 +08:00
ping: { driver: "ping" }
2014-11-26 08:01:31 +08:00
},
2014-05-14 10:06:40 +08:00
2014-08-08 04:44:25 +08:00
work: function(my) {
2015-04-15 12:49:12 +08:00
every((1).seconds(), function() {
2014-12-14 08:19:25 +08:00
console.log("Hello, human!");
2014-08-08 04:44:25 +08:00
console.log(my.ping.ping());
2014-08-01 07:45:18 +08:00
});
2015-04-15 12:49:12 +08:00
after((5).seconds(), function() {
2014-12-14 08:19:25 +08:00
console.log("I've been at your command for 5 seconds now.");
2014-08-01 07:45:18 +08:00
});
}
2014-05-14 10:06:40 +08:00
});
Cylon.start();