"use strict";
var Cylon = require("cylon");
Cylon
.robot()
.connection("tessel", { adaptor: "tessel", port: "A" })
.device("ir", { driver: "ir-attx4" })
.on("ready", function(bot) {
bot.ir.on("error", function(err) {
console.log(err);
});
bot.ir.on("data", function(data) {
console.log("Received RX Data: ", data);
});
setInterval(function() {
var powerBuffer = new Buffer([0, 178, 255, 168, 0, 12, 255, 246, 0, 13, 255, 225, 0, 13, 255, 224, 0, 12, 255, 246, 0, 12, 255, 246, 0, 13, 255, 247, 0, 13, 255, 247, 0, 13, 255, 224, 0, 12, 255, 224, 0, 13, 255, 247, 0, 13, 255, 224, 0, 12, 255, 246, 0, 12, 255, 246, 0, 12, 255, 246, 0, 12, 255, 246, 0, 13, 255, 247, 0, 13, 255, 224, 0, 12, 255, 224, 0, 13, 255, 225, 0, 13, 255, 224, 0, 12, 255, 246, 0, 12, 255, 246, 0, 13, 255, 247, 0, 13, 255, 247, 0, 13, 255, 246, 0, 12, 255, 246, 0, 12, 255, 246, 0, 12, 255, 246, 0, 12, 255, 224, 0, 13, 255, 224, 0, 12, 255, 224, 0, 12, 255, 224, 0, 12]);
bot.ir.sendRawSignal(38, powerBuffer, function(err) {
if (err) {
console.log("Unable to send signal: ", err);
return;
}
console.log("Signal sent!");
});
}, 3000);
});
Cylon.start();