Updated digital pin lib and example.
This commit is contained in:
parent
3b078321f1
commit
b03019544b
|
@ -107,7 +107,7 @@
|
|||
|
||||
DigitalPin.prototype._setMode = function(mode) {
|
||||
var _this = this;
|
||||
if (this.mode === 'w') {
|
||||
if (mode === 'w') {
|
||||
return FS.writeFile("" + GPIO_PATH + "/gpio" + this.pinNum + "/direction", GPIO_DIRECTION_WRITE, function(err) {
|
||||
if (err) {
|
||||
return _this.self.emit('error', "Setting up pin direction failed");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require('../dist/digital-pin')
|
||||
|
||||
pin4 = new Cylon.IO.DigitalPin(pin: 4)
|
||||
pin4 = new Cylon.IO.DigitalPin(pin: 4, mode: 'w')
|
||||
|
||||
pin4.on('open', (data) ->
|
||||
console.log("Pin files have been created")
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace 'Cylon.IO', ->
|
|||
|
||||
# Sets the mode for the GPIO pin by writing the correct values to the pin reference files
|
||||
_setMode: (mode) ->
|
||||
if @mode == 'w'
|
||||
if mode == 'w'
|
||||
FS.writeFile("#{ GPIO_PATH }/gpio#{ @pinNum }/direction", GPIO_DIRECTION_WRITE, (err) =>
|
||||
if (err)
|
||||
@self.emit('error', "Setting up pin direction failed")
|
||||
|
|
Loading…
Reference in New Issue