update for db testin
This commit is contained in:
parent
21513c81f2
commit
43ea1e9eb1
1 changed files with 11 additions and 3 deletions
|
@ -1,7 +1,10 @@
|
|||
var express = require('express');
|
||||
var router = express.Router();
|
||||
var Arduino = new require('../ar-com/arduino');
|
||||
var arduino = new Arduino();
|
||||
var arcom = new require('../ar-com');
|
||||
var RCDB = new require('../models/rc_db');
|
||||
var rc_db = new RCDB();
|
||||
var arduino = new arcom.Arduino();
|
||||
var rc = new arcom.RC(arduino);
|
||||
|
||||
arduino.setup();
|
||||
|
||||
|
@ -11,10 +14,15 @@ router.get('/', function(req, res, next) {
|
|||
});
|
||||
|
||||
router.get('/toggleLight', function (req, res) {
|
||||
var s = "0FFF0FFF000F";
|
||||
/*var s = "0FFF0FFF000F";
|
||||
var str = "";
|
||||
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);
|
||||
});
|
||||
res.send('switch light');
|
||||
});
|
||||
|
||||
|
|
Reference in a new issue