From 43db32eea57ef8c93ba5bf2d0a6ba60ae7fffdeb Mon Sep 17 00:00:00 2001 From: Stefan Sterz Date: Sun, 28 Feb 2016 22:31:36 +0100 Subject: [PATCH] add ir receive test --- nodejs/ar-com/ir.js | 3 ++- nodejs/routes/index.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) 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'); });