Debugging digitalPin read.
This commit is contained in:
parent
e40289b3ea
commit
ad39fdaf80
|
@ -77,13 +77,14 @@
|
|||
this._setMode('w');
|
||||
}
|
||||
this.status = value === 1 ? 'high' : 'low';
|
||||
return FS.writeFile(this._valuePath(), value, function(err) {
|
||||
FS.writeFile(this._valuePath(), value, function(err) {
|
||||
if (err) {
|
||||
return _this.emit('error', "Error occurred while writing value " + value + " to pin " + _this.pinNum);
|
||||
} else {
|
||||
return _this.emit('digitalWrite', value);
|
||||
}
|
||||
});
|
||||
return value;
|
||||
};
|
||||
|
||||
DigitalPin.prototype.digitalRead = function(interval) {
|
||||
|
@ -93,16 +94,19 @@
|
|||
this._setMode('r');
|
||||
}
|
||||
readData = null;
|
||||
return setInterval(function() {
|
||||
setInterval(function() {
|
||||
return FS.readFile(_this._valuePath(), function(err, data) {
|
||||
if (err) {
|
||||
return _this.emit('error', "Error occurred while reading from pin " + _this.pinNum);
|
||||
} else {
|
||||
readData = data;
|
||||
console.log("ReadData =======>");
|
||||
console.log(data);
|
||||
return _this.emit('digitalRead', data);
|
||||
}
|
||||
});
|
||||
}, interval);
|
||||
return true;
|
||||
};
|
||||
|
||||
DigitalPin.prototype.setHigh = function() {
|
||||
|
|
|
@ -58,6 +58,8 @@ namespace 'Cylon.IO', ->
|
|||
@emit('digitalWrite', value)
|
||||
)
|
||||
|
||||
value
|
||||
|
||||
# Reads the pin input every interval amount of time:
|
||||
# params:
|
||||
# interval: amount in miliseconds
|
||||
|
@ -71,10 +73,14 @@ namespace 'Cylon.IO', ->
|
|||
@emit('error', "Error occurred while reading from pin #{ @pinNum }")
|
||||
else
|
||||
readData = data
|
||||
console.log("ReadData =======>")
|
||||
console.log(data)
|
||||
@emit('digitalRead', data)
|
||||
)
|
||||
, interval)
|
||||
|
||||
true
|
||||
|
||||
setHigh: ->
|
||||
@digitalWrite 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue