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
92aa73a5
authored
Dec 17, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
problemas de sincronismo
parent
f65e7b16
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
public/assets/main.js
webserver.js
public/assets/main.js
View file @
92aa73a5
...
@@ -71,6 +71,16 @@ socket.on('actualizarEstado', function(data) {
...
@@ -71,6 +71,16 @@ socket.on('actualizarEstado', function(data) {
});
});
socket
.
on
(
'bloquearBotones'
,
function
(
data
)
{
document
.
getElementById
(
'abrir'
).
disabled
=
true
;
document
.
getElementById
(
'cerrar'
).
disabled
=
true
;
});
socket
.
on
(
'desbloquearBotones'
,
function
(
data
)
{
document
.
getElementById
(
'abrir'
).
disabled
=
false
;
document
.
getElementById
(
'cerrar'
).
disabled
=
false
;
});
/*
/*
Lee los parametros GET si existen para abrir o cerrar directamente, sin boton
Lee los parametros GET si existen para abrir o cerrar directamente, sin boton
*/
*/
...
...
webserver.js
View file @
92aa73a5
...
@@ -63,7 +63,7 @@ setInterval(function () {
...
@@ -63,7 +63,7 @@ setInterval(function () {
// Abrir puerta
// Abrir puerta
function
abrirPuerta
(){
function
abrirPuerta
(){
socket
.
broadcast
.
emit
(
"bloquearBotones"
,
Number
(
estadoPuerta
));
RED
.
pwmWrite
(
0
);
RED
.
pwmWrite
(
0
);
GREEN
.
pwmWrite
(
255
);
GREEN
.
pwmWrite
(
255
);
...
@@ -80,11 +80,13 @@ function abrirPuerta(){
...
@@ -80,11 +80,13 @@ function abrirPuerta(){
}
}
},
100
);
},
100
);
socket
.
broadcast
.
emit
(
"desbloquearBotones"
,
Number
(
estadoPuerta
));
}
}
// Cerrar puerta
// Cerrar puerta
function
cerrarPuerta
(){
function
cerrarPuerta
(){
socket
.
broadcast
.
emit
(
"bloquearBotones"
,
Number
(
estadoPuerta
));
GREEN
.
pwmWrite
(
0
);
GREEN
.
pwmWrite
(
0
);
RED
.
pwmWrite
(
255
);
RED
.
pwmWrite
(
255
);
...
@@ -106,6 +108,8 @@ function cerrarPuerta(){
...
@@ -106,6 +108,8 @@ function cerrarPuerta(){
}
}
},
100
);
},
100
);
socket
.
broadcast
.
emit
(
"desbloquearBotones"
,
Number
(
estadoPuerta
));
}
}
// Clean LEDs
// Clean LEDs
...
...
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