problemas de sincronismo

parent b7af6777
Showing with 8 additions and 7 deletions
......@@ -56,9 +56,9 @@ trigger.digitalWrite(0);
}
});
}());
// Trigger a distance measurement once per second
// Lanza la medicion de distancia una vez cada segundo
setInterval(function () {
trigger.trigger(10, 1); // Set trigger high for 10 microseconds
trigger.trigger(10, 1); // Lanza una señal HIGHT durante 10ms
}, 1000);
// Abrir puerta
......@@ -108,11 +108,6 @@ function cerrarPuerta(){
}, 100);
}
// Clean LEDs
//RED.pwmWrite(dutyCycle);
//GREEN.pwmWrite(dutyCycle);
//BLUE.pwmWrite(dutyCycle);
/*
WEB SERVER
......@@ -150,6 +145,12 @@ io.sockets.on('connection', function (socket) { // WebSocket Connection
if (estadoPuerta == 1 && ordenRecibida == 0) {
cerrarPuerta();
console.log("Cerrando puerta");
if(obstaculo){
ordenRecibida = 1;
socket.broadcast.emit("actualizarEstado", Number(estadoPuerta));
socket.emit("actualizarEstado", Number(estadoPuerta));
}
}
if (estadoPuerta == 1 && ordenRecibida == 1) console.log("La puerta ya se encuentra abierta");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment