Hello guys, Im trying to run a local webpage and usually app labs is not giving me any problems but in this case when I select with these codes app labs just freeze and I cant make anything at all. Just a few seconds earlier I restarted app labs and now it works but I did it before and it did not I used this code in general just checking that it isn´t too much for the uno Q
.ino
#include <Arduino_RouterBridge.h>
int detector = A0;
int lectura;
void setup() {
// put your setup code here, to run once:
Monitor.begin(9600);
Bridge.begin();
}
void loop() {
// put your main code here, to run repeatedly:
lectura= analogRead(detector);
Monitor.println(lectura);
Bridge.notify("El_valor_es_de:", lectura);
delay(1000);
}
.py
from arduino.app_utils import App, Bridge # llamada del bridge y la conexión con el archivo .ino
from arduino.app_bricks.web_ui import WebUI # llamada del puente y conexión con la nube
ui = WebUI() # definición de WebUI
def lectura_voltaje_medido(lectura_voltaje: int):
ui.send_message("Voltaje medido en V",str(lectura_voltaje) )
print(lectura_voltaje)
Bridge.provide("El_valor_es_de:", lectura_voltaje_medido)
# See: https://docs.arduino.cc/software/app-lab/tutorials/getting-started/#app-run
App.run()
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Variable en la nube</title>
<link rel = "stylesheet" href = "estilos.css"> <!-- Esto es para ligar la parte del HTML con el Css-->
</head>
<body>
<div class = "pagina_general"> <!-- el div hace una clase diferente para diferenciarlo por aparte-->
<header id = "arduino"> <!-- Recordemos no utilizar mas de una vez el id pues, es para diferenciar variables -->
<h1>Recursos brindado por arduino</h1>
</header>
<nav class = "menu">
<ul>
<li> Batería</li>
<li> velocidad </li>
<li>eficiencia</li>
</ul>
</nav>
<section class = "contenido">
<article >
<hgroup>
<h2> Batería(dato crudo)</h2>
</hgroup>
<div id="lectura_voltaje">--</div>
<script src="https://cdn.socket.io/4.8.3/socket.io.min.js"
integrity="sha384-kzavj5fiMwLKzzD1f8S7TeoVIEi7uKHvbTA3ueZkrzYq75pNQUiUi6Dy98Q3fxb0"
crossorigin="anonymous"></script>
<script>
const socket = io();
socket.on("Voltaje medido en V", function(data) {
document.getElementById("lectura_voltaje").textContent = data;
});
</script>
</article>
</section>
<section class = "contenido">
<article>
<hgroup>
<h2> Velocidad(por hacer)</h2>
</hgroup>
<p> Inserte el dato aquí</p>
</article>
</section>
<section class = "contenido">
<article>
<hgroup>
<h2> Eficiencia(por usar)</h2>
</hgroup>
<p> Inserte el dato aquí</p>
</article>
</section>
<aside class = "Columna_grafica">
<hgroup>
<h2 class = "grafica" ">
Gráfica de uso de batería(perdida y ganancias). Por agregare
</h2>
</hgroup>
<p>inserte gráfica 1</p>
</aside>
<aside>
<hgroup>
<h2 class = "grafica">
Gráfica de velocidades
</h2>
</hgroup>
<p>inserte gráfica 2</p>
</aside>
<aside>
<hgroup>
<h2 class = "grafica">
Gráfica de eficiencias(esfuerzos y condiciones internas si se acerca al 100 sería un problema y se notificaría)
</h2>
</hgroup>
<p>inserte gráfica 3</p>
</aside>
</div>
</body>
</html>
Css
/*<!-- Estilos de HTML generales -->
<!-- Para un estilo individual, solamente aplicalo al header, articulo o otra parte del que quieras cambiar -->*/
/* Para una regla universal de una pagina se usa * sin embargo no es tan recomendable usarlo entonces
se usara :root */
*{
margin: 5px;
padding: 10px;
}
nav {
font: 20px sans-serif;
text-align: center;
}
article{
font: 20px bold sans-serif;
background: #29A9ED;
color: black;
border-radius: 10px;
text-align: left
}
header {
font: 25px bold sans-serif;
padding: 20px;
background: green;
color: limegreen;
}
hgroup{
color: black;
}
#arduino {
background: #29A9ED;
color: black;
border-radius: 10px;
text-align:center;
}
.grafica {
font: 30px bold sans-serif;
border-radius: 10px;
background: #29A9ED;
color: black;
}
header,article, nav, footer, aside{
/* Sección del bloque de afuera*/
border: 1px solid black;
display: block;
padding: 5px;
/*background: black;*/
}
.pagina_general{
/* todo el body sin afectar el body*/
width: 1200px;
/*background: #227093;*/
border: 1px solid black;
margin: 0px;
}
.menu {
background: #29A9ED;
padding: 1px 15px;
border-radius: 10px;
}
.menu li/*afecta todas las listas en una clase*/{
list-style: none;
padding: 5px;
border: 1px solid black;
display: inline-block;
}
.contenido{
margin: 20px 300px;
border: 5px solid black;
color: red;
text-align: left;
}
.columna_grafica{
color: black;
}
/* <!-- Se pueden también utilizar clases para agrupar mas de un tipo de diseño se llaman con class -->*/
ignore the comments usually it´s a mini tutorial for me since it´s the first time I use css and HTML but with this I dont know why, today app labs freeze