Skip to content

Instantly share code, notes, and snippets.

@kakobotasso
Created August 19, 2017 13:18
Show Gist options
  • Save kakobotasso/878ea3af807d8c3cdd74485b090e3094 to your computer and use it in GitHub Desktop.
Save kakobotasso/878ea3af807d8c3cdd74485b090e3094 to your computer and use it in GitHub Desktop.
FIAP Arduino Liga/Desliga LED
var express = require('express');
var five = require('johnny-five');
var app = express();
var board = new five.Board({port:"COM3"});
var relay;
board.on("ready", function(){
console.log("Arduino conectado");
relay = new five.Relay(13);
});
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.get('/liga-led', function (req, res) {
relay.on();
res.send('Liga o led');
});
app.get('/desliga-led', function (req, res) {
relay.off();
res.send('Desliga o led');
});
app.get('/temperatura-atual', function (req, res) {
res.send('Temperatura atual');
});
app.listen(3000, function() {
console.log('listening');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment