Remove logging and update example.

This commit is contained in:
Edgar O Silva 2013-11-05 12:37:15 -06:00
parent 81bd0adb83
commit 115a1bb405
3 changed files with 2 additions and 17 deletions

7
dist/digital-pin.js vendored
View File

@ -46,7 +46,6 @@
var _this = this;
return FS.writeFile("" + GPIO_PATH + "/export", "" + this.pinNum, function(err) {
if (err) {
console.log('Error while creating pin files ...');
return _this.self.emit('error', 'Error while creating pin files');
} else {
_this.self.emit('open');
@ -59,7 +58,6 @@
var _this = this;
return FS.writeFile("" + GPIO_PATH + "/unexport", "" + this.pinNum, function(err) {
if (err) {
console.log('Error while closing pin files ...');
return _this.self.emit('error', 'Error while closing pin files');
} else {
return _this.self.emit('close');
@ -75,10 +73,8 @@
this.status = value === 1 ? 'high' : 'low';
return FS.writeFile(this.pinFile, value, function(err) {
if (err) {
console.log('ERROR occurred while writing to the Pin File');
return _this.self.emit('error', "Error occurred while writing value " + value + " to pin " + _this.pinNum);
} else {
console.log('Pin File written successfully');
return _this.self.emit('digitalWrite', value);
}
});
@ -93,7 +89,6 @@
readData = null;
FS.readFile(this.pinFile, function(err, data) {
if (err) {
console.log('ERROR occurred while reading from the Pin');
return _this.self.emit('error', "Error occurred while reading from pin " + _this.pinNum);
} else {
readData = data;
@ -109,7 +104,6 @@
if (this.mode === 'w') {
return FS.writeFile("" + GPIO_PATH + "/gpio" + this.pinNum + "/direction", GPIO_DIRECTION_WRITE, function(err) {
if (err) {
console.log('Error occurred while settingup pin mode(direction)...');
return _this.self.emit('error', "Setting up pin direction failed");
} else {
_this.pinFile = "" + GPIO_PATH + "/gpio" + _this.pinNum + "/value";
@ -120,7 +114,6 @@
} else if (mode === 'r') {
return FS.writeFile("" + GPIO_PATH + "/gpio" + this.pinNum + "/direction", GPIO_DIRECTION_READ, function(err) {
if (err) {
console.log('Error occurred while settingup pin mode(direction)...');
return _this.self.emit('error', "Setting up pin direction failed");
} else {
_this.pinFile = "" + GPIO_PATH + "/gpio" + _this.pinNum + "/value";

View File

@ -12,8 +12,7 @@ pin4.on('digitalWrite', (value) ->
pin4.on('connect', (data) ->
console.log("Pin mode has been setup!")
pin4.digitalWrite(1)
pin4.setHigh()
)
pin4.open()
pin4.connect()

View File

@ -34,7 +34,6 @@ namespace 'Cylon.IO', ->
# Creates the GPIO file to read/write from
FS.writeFile("#{ GPIO_PATH }/export", "#{ @pinNum }", (err) =>
if(err)
console.log('Error while creating pin files ...')
@self.emit('error', 'Error while creating pin files')
else
@self.emit('open')
@ -45,7 +44,6 @@ namespace 'Cylon.IO', ->
close: ->
FS.writeFile("#{ GPIO_PATH }/unexport", "#{ @pinNum }", (err) =>
if(err)
console.log('Error while closing pin files ...')
@self.emit('error', 'Error while closing pin files')
else
@self.emit('close')
@ -57,10 +55,8 @@ namespace 'Cylon.IO', ->
FS.writeFile(@pinFile, value, (err) =>
if (err)
console.log('ERROR occurred while writing to the Pin File')
@self.emit('error', "Error occurred while writing value #{ value } to pin #{ @pinNum }")
else
console.log('Pin File written successfully')
@self.emit('digitalWrite', value)
)
@ -70,7 +66,6 @@ namespace 'Cylon.IO', ->
FS.readFile(@pinFile, (err, data) =>
if err
console.log('ERROR occurred while reading from the Pin')
@self.emit('error', "Error occurred while reading from pin #{ @pinNum }")
else
readData = data
@ -85,7 +80,6 @@ namespace 'Cylon.IO', ->
if @mode == 'w'
FS.writeFile("#{ GPIO_PATH }/gpio#{ @pinNum }/direction", GPIO_DIRECTION_WRITE, (err) =>
if (err)
console.log('Error occurred while settingup pin mode(direction)...')
@self.emit('error', "Setting up pin direction failed")
else
@pinFile = "#{ GPIO_PATH }/gpio#{ @pinNum }/value"
@ -95,7 +89,6 @@ namespace 'Cylon.IO', ->
else if mode =='r'
FS.writeFile("#{ GPIO_PATH }/gpio#{ @pinNum }/direction", GPIO_DIRECTION_READ, (err) =>
if (err)
console.log('Error occurred while settingup pin mode(direction)...')
@self.emit('error', "Setting up pin direction failed")
else
@pinFile = "#{ GPIO_PATH }/gpio#{ @pinNum }/value"