add ir receive test

This commit is contained in:
Stefan Sterz 2016-02-28 22:31:36 +01:00
parent 900f809731
commit 43db32eea5
2 changed files with 3 additions and 1 deletions

View File

@ -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'));
};

View File

@ -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');
});