Simple example of how to use dynamic devices
This commit is contained in:
parent
8921e902eb
commit
16cdb56be6
|
@ -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();
|
Loading…
Reference in New Issue