diff --git a/nodejs/ar-com/arduino.js b/nodejs/ar-com/arduino.js index f826fe0..687c498 100644 --- a/nodejs/ar-com/arduino.js +++ b/nodejs/ar-com/arduino.js @@ -3,7 +3,7 @@ var events = require('events'), util = require('util'), serial = require("serialport"); -var Arduino = function (baudrate, debug) { +var Arduino = function (debug, baudrate) { this.baudrate = baudrate && baudrate || 9600; this.debug = debug && debug || false; this.writeBuffer = []; @@ -18,7 +18,11 @@ Arduino.prototype.setup = function () { var self = this; child.exec('cd ../arduino && ino build && ino upload', function(err, stdout, stderr){ - if(err){console.log('Please install the ino utility and connect arduino!\nIf there are other open programs that communicate with the arduino, close them!'); return;} + if(err){ + console.log('Please install the ino utility and connect arduino!\nIf there are other open programs that communicate with the arduino, close them!'); + if(self.debug) {console.log(err.message);} + return; + } var buff = stdout.slice(stdout.indexOf('Guessing serial port ... ')+25); buff = buff.slice(0, buff.indexOf('\n')); diff --git a/nodejs/routes/index.js b/nodejs/routes/index.js index cf66f36..8b9ef17 100644 --- a/nodejs/routes/index.js +++ b/nodejs/routes/index.js @@ -12,7 +12,7 @@ var rc_db = new models.RCDB(); var users = new models.Users(); // Arduino communications -var arduino = new arcom.Arduino(); +var arduino = new arcom.Arduino(true); var rc = new arcom.RC(arduino); // Get arduino ready