diff --git a/examples/start-device/start-device.js b/examples/start-device/start-device.js new file mode 100644 index 0000000..cb5fe40 --- /dev/null +++ b/examples/start-device/start-device.js @@ -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();