Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Sebastián Collado Montañez
/
proyecto-micro
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
87466ce4
authored
Dec 17, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
problemas de sincronismo
parent
806fc5c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
webserver.js
webserver.js
View file @
87466ce4
...
@@ -83,7 +83,7 @@ function abrirPuerta(){
...
@@ -83,7 +83,7 @@ function abrirPuerta(){
}
}
// Cerrar puerta
// Cerrar puerta
function
cerrarPuerta
(){
function
cerrarPuerta
(
socket
){
GREEN
.
pwmWrite
(
0
);
GREEN
.
pwmWrite
(
0
);
RED
.
pwmWrite
(
255
);
RED
.
pwmWrite
(
255
);
...
@@ -103,6 +103,8 @@ function cerrarPuerta(){
...
@@ -103,6 +103,8 @@ function cerrarPuerta(){
if
(
obstaculo
){
if
(
obstaculo
){
clearInterval
(
intervalo
);
clearInterval
(
intervalo
);
abrirPuerta
();
abrirPuerta
();
socket
.
broadcast
.
emit
(
"actualizarEstado"
,
Number
(
1
));
socket
.
emit
(
"actualizarEstado"
,
Number
(
1
));
}
}
},
100
);
},
100
);
...
@@ -143,14 +145,8 @@ io.sockets.on('connection', function (socket) { // WebSocket Connection
...
@@ -143,14 +145,8 @@ io.sockets.on('connection', function (socket) { // WebSocket Connection
console
.
log
(
"Abriendo puerta"
);
console
.
log
(
"Abriendo puerta"
);
}
}
if
(
estadoPuerta
==
1
&&
ordenRecibida
==
0
)
{
if
(
estadoPuerta
==
1
&&
ordenRecibida
==
0
)
{
cerrarPuerta
();
cerrarPuerta
(
socket
);
console
.
log
(
"Cerrando puerta"
);
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"
);
if
(
estadoPuerta
==
1
&&
ordenRecibida
==
1
)
console
.
log
(
"La puerta ya se encuentra abierta"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment