18 lines
425 B
JavaScript
18 lines
425 B
JavaScript
var express = require('express');
|
|
var router = express.Router();
|
|
var Arduino = new require('../ar-com/arduino');
|
|
var arduino = new Arduino();
|
|
|
|
arduino.setup();
|
|
|
|
/* GET home page. */
|
|
router.get('/', function(req, res, next) {
|
|
res.render('index', { title: 'Express' });
|
|
});
|
|
|
|
router.get('/toggleLight', function (req, res) {
|
|
arduino.write(new Buffer('~','ascii'));
|
|
res.send('switch light');
|
|
});
|
|
|
|
module.exports = router;
|