fix typos and minor bugs

This commit is contained in:
Shannon Sterz 2016-02-17 14:39:03 +01:00
parent f8436e2a81
commit 79d8b4e1d0
2 changed files with 5 additions and 5 deletions

View file

@ -9,8 +9,8 @@ var RC = function (arduino, pin) {
RC.prototype.send = function(tristate) {
var str = '';
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'));
for(i = 0; i < tristate.length; i+=2) { str += String.fromCharCode(parseInt(tristate.substr(i,2), 16)); }
this.arduino.write(new Buffer('W' + String.fromCharCode(97 + this.pin) + str,'ascii'));
}
RC.prototype.sendDecimal = function (len, val) {

View file

@ -19,9 +19,9 @@ router.get('/toggleLight', function (req, res) {
for(i = 0; i < s.length; i+=2) { str += String.fromCharCode(parseInt(s.substr(i,2), 16)); }
arduino.write(new Buffer('Wl' + str,'ascii'));
res.send('switch light');*/
rc_db.fidn(1, function (error, results, fields) {
rc.send(results[0].on_value);
rc_db.find(1, function (error, results, fields) {
if(error) console.log(error);
rc.send(results[0].on_value);
});
res.send('switch light');
});