Browse Source

prova3 amb raspberry

master
nau 8 years ago
parent
commit
c1e330bc54
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      server.js

+ 3
- 3
server.js

@ -30,7 +30,7 @@ io.on('connection', function (socket) {
socket.on('newconnection', function (data,callback){ socket.on('newconnection', function (data,callback){
numconnections++; numconnections++;
console.log("numconnections: " + numconnections); console.log("numconnections: " + numconnections);
io.sockets.emit('numconnections',{numconnections}); //aqí envia la data
//io.sockets.emit('numconnections',{numconnections}); //aqí envia la data
}); });
socket.on('pinON', function (data,callback){ socket.on('pinON', function (data,callback){
console.log(data + "--> ON"); console.log(data + "--> ON");
@ -45,7 +45,7 @@ io.on('connection', function (socket) {
gpio.close(data); // Close pin gpio.close(data); // Close pin
}); });
}); });
io.sockets.emit('listPinsON',{listPinsON});
io.sockets.emit('listPinsON',listPinsON);
}else{ }else{
//pin already encès //pin already encès
io.sockets.emit("alreadyON", data); io.sockets.emit("alreadyON", data);
@ -68,7 +68,7 @@ io.on('connection', function (socket) {
gpio.close(data); // Close pin gpio.close(data); // Close pin
}); });
}); });
io.sockets.emit('listPinsON',{listPinsON}); //aqí envia la data
io.sockets.emit('listPinsON',listPinsON); //aqí envia la data
}); });

Loading…
Cancel
Save