diff --git a/nodejs/ar-com/ir.js b/nodejs/ar-com/ir.js index 3db4d14..6b025e6 100644 --- a/nodejs/ar-com/ir.js +++ b/nodejs/ar-com/ir.js @@ -13,6 +13,7 @@ var IR = function (arduino) { return; } + console.log(m); this.emit('read', err, m); }.bind(this)); @@ -25,7 +26,7 @@ IR.prototype.send = function(type, len, val) { type = String.fromCharCode(type); len = String.fromCharCode(len); val = this.arduino.valueToLastFour(val); - + this.arduino.write(new Buffer('X0' + type + len + val,'ascii')); }; diff --git a/nodejs/routes/index.js b/nodejs/routes/index.js index f61ebaa..04d78e1 100644 --- a/nodejs/routes/index.js +++ b/nodejs/routes/index.js @@ -61,6 +61,7 @@ router.post('/changeRC', auth, function (req, res, next){ // IR Routes router.get('/irTest', auth, function (req, res) { //arduino.write(new Buffer('X0' + String.fromCharCode(4) + String.fromCharCode(12) + String.fromCharCode(0)+String.fromCharCode(0)+String.fromCharCode(2689 / 256) + String.fromCharCode(2689 % 256),'ascii')); + ir.receive(); ir.send(4,12,2689); res.send('switch light'); });