From ad99525d23b73cbc7baaff0c4f70dd1ad96e84b9 Mon Sep 17 00:00:00 2001 From: Stefan Sterz Date: Thu, 21 Jan 2016 22:01:57 +0100 Subject: [PATCH] add IR Test Button --- nodejs/ar-com/arduino.js | 2 +- nodejs/public/javascripts/angularApp.js | 10 ++++++++++ nodejs/routes/index.js | 5 +++++ nodejs/views/index.ejs | 3 +++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/nodejs/ar-com/arduino.js b/nodejs/ar-com/arduino.js index b41b7e0..15c624d 100644 --- a/nodejs/ar-com/arduino.js +++ b/nodejs/ar-com/arduino.js @@ -37,7 +37,7 @@ Arduino.prototype.setup = function () { self.serial.on('open', function () { setTimeout(function () { self.serial.write(new Buffer('00000000')); - self.serial.write(new Buffer('Z0000000', 'ascii')); + self.serial.write(new Buffer('Zn000000', 'ascii')); self.emit('success'); self.serial.on('data', function(data){ diff --git a/nodejs/public/javascripts/angularApp.js b/nodejs/public/javascripts/angularApp.js index 0b37b28..fa737b2 100644 --- a/nodejs/public/javascripts/angularApp.js +++ b/nodejs/public/javascripts/angularApp.js @@ -21,6 +21,10 @@ app.factory('arduino', ['$http', function($http, auth){ return $http.get('/toggleLight'); } + o.irTest = function ( ) { + return $http.get('/irTest'); + } + return o; }]); @@ -32,4 +36,10 @@ app.controller('MainCtrl', ['$scope', 'arduino', function ($scope, arduino){ }; + $scope.irTest = function(){ + + arduino.toggleLight(); + + }; + }]); \ No newline at end of file diff --git a/nodejs/routes/index.js b/nodejs/routes/index.js index cd448cf..ce6e1c4 100644 --- a/nodejs/routes/index.js +++ b/nodejs/routes/index.js @@ -18,4 +18,9 @@ router.get('/toggleLight', function (req, res) { res.send('switch light'); }); +router.get('/irTest', function (req, res) { + arduino.write(new Buffer('Y0000000' ,'ascii')); + res.send('switch light'); +}); + module.exports = router; diff --git a/nodejs/views/index.ejs b/nodejs/views/index.ejs index ab4ce79..72974b5 100644 --- a/nodejs/views/index.ejs +++ b/nodejs/views/index.ejs @@ -29,6 +29,9 @@
+
+ +