Simple example of how to use dynamic devices

This commit is contained in:
deadprogram 2015-09-07 08:47:25 -07:00
parent 8921e902eb
commit 16cdb56be6
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
"use strict";
var Cylon = require("cylon");
Cylon.robot({
connections: {
loopback: { adaptor: "loopback" }
},
connectPinger: function() {
this.device("pinger",
{connection: "loopback", driver: "ping"});
this.startDevice(this.devices.pinger, function() {
console.log("Get ready to ping...");
});
},
work: function(my) {
my.connectPinger();
every((1).second(), function() {
console.log(my.pinger.ping());
});
}
}).start();