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 @@
+