This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
trev/nodejs/routes/index.js
Stefan Sterz 54850cde26 refactor code
The communication with the arduino is now handled by a designated module (called ar-com).
2016-01-14 21:19:41 +01:00

18 lines
424 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;