mino bug fixes
This commit is contained in:
parent
43ea1e9eb1
commit
f8436e2a81
1 changed files with 6 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
|
var events = require('events'),
|
||||||
|
util = require('util');
|
||||||
|
|
||||||
var RC = function (arduino, pin) {
|
var RC = function (arduino, pin) {
|
||||||
if(!arduino){throw new Error('Arduino must be set');}
|
if(!arduino){throw new Error('Arduino must be set');}
|
||||||
|
@ -10,7 +11,7 @@ RC.prototype.send = function(tristate) {
|
||||||
var str = '';
|
var str = '';
|
||||||
for(i = 0; i < s.length; i+=2) { str += String.fromCharCode(parseInt(tristate.substr(i,2), 16)); }
|
for(i = 0; i < s.length; i+=2) { str += String.fromCharCode(parseInt(tristate.substr(i,2), 16)); }
|
||||||
arduino.write(new Buffer('W' + String.fromCharCode(97 + this.pin) + str,'ascii'));
|
arduino.write(new Buffer('W' + String.fromCharCode(97 + this.pin) + str,'ascii'));
|
||||||
};
|
}
|
||||||
|
|
||||||
RC.prototype.sendDecimal = function (len, val) {
|
RC.prototype.sendDecimal = function (len, val) {
|
||||||
|
|
||||||
|
@ -18,4 +19,6 @@ RC.prototype.sendDecimal = function (len, val) {
|
||||||
val = this.arduino.valueToLastFour(val);
|
val = this.arduino.valueToLastFour(val);
|
||||||
|
|
||||||
arduino.write(new Buffer('W' + String.fromCharCode(97 + this.pin) + len + val,'ascii'));
|
arduino.write(new Buffer('W' + String.fromCharCode(97 + this.pin) + len + val,'ascii'));
|
||||||
};
|
}
|
||||||
|
|
||||||
|
module.exports = RC;
|
Reference in a new issue