Hola buenas! Estoy haciendo un proyecto para el cual quiero que me salgan diferentes notificaciones según vayan cumpliéndose una serie de cosas, y es que no me sale ninguna.
Vale, creo que no me funcionaba porque Arduino me había actualizado automáticamente a la versión beta de la librería. He vuelto a restaurar la anterior y funciona todo bien.
What logging level do you have defined in your server properties file?
Note that changing these settings from within the web portray has no effect, you need to edit the file directly, then re-start the server.
What value do you have for this server.properties entry…
#this setting defines how often we can send mail/tweet/push or any other notification. Specified in seconds
notifications.frequency.user.quota.limit=15
No, las notificaciones están en los botones, por ejemplo:
BLYNK_WRITE(V34) {
startTraining = param.asInt();
if (startTraining == 1) { // si se pulsa
Blynk.notify("Espere hasta que la máquina se prepare para acceder al control fisiológico.");
delay(10000);
Blynk.notify("Máquina lista. ¡Ha empezado tu entrenamiento!");
for (int i = 0; i < numSesiones; i++) {
i = sesionActual;
while (millis() <= (tiempoCiclo * 60 * 1000)) {
timer.setInterval(1000L, sendSensor);
}
Blynk.notify(String("Ciclo finalizado. Descanse ") + tiempoDescanso + String(" minutos."));
delay(tiempoDescanso * 60 * 1000);
}
Blynk.notify(String("Entrenamiento finalizado."));
}
}
Well, that’s a horrible piece of code. The 10 second blocking delay is likely to cause a server disconnection, and the two notifications are being sent at the minimum frequency specified in your server properties file.
Vale, ahora entiendo porque se me desconectaba del servidor. Tenía el presentimiento de que los delays no funcionaban bien, los voy a quitar y probar de nuevo.
Lo de mandar dos notificaciones una detrás de otra, ¿también debería quitarlo?
The notifications have to be at least the minimum number of seconds defined in your server.properties file apart, and that’s assuming that you don’t exceed Google’s limits for this messaging service.
As far as I’m concerned, yopure using notifications in the wrong way. They shpould be used to tell you about exceptional or random events, nit telling you about two things that happen 10 seconds apart.
For that sort of data you’d be better using value, table or terminal widgets.
Una última pregunta, ¿este tipo de código es inviable para Blynk? ¿Cuáles podrían ser soluciones alternativas sin variar su funcionalidad? (Esos delay no dan fallo, que ya he hecho pruebas antes, así que el problema debe estar con el bucle for y while, pero no sé como implementar una alternativa)
BLYNK_WRITE(V34) {
startTraining = param.asInt();
if (startTraining == 1) { // si se pulsa
Blynk.notify("Espere hasta que la máquina se prepare para acceder al control fisiológico.");
delay(4000);
Blynk.virtualWrite(V39, "Máquina lista. ¡Ha comenzado tu entrenamiento!");
delay(5000);
Blynk.virtualWrite(V39, "Ve a Sensórica para seguir tu entrenamiento.");
for (int i = 1; i < numSesiones; i++) {
sesionActual = i;
int start = millis();
while (millis() < start+(tiempoCiclo * 60 * 1000)) {
timer.setInterval(1000L, sendSensor);
}
Blynk.notify(String("Ciclo finalizado. Descanse ") + tiempoDescanso + String(" minutos."));
}
Blynk.notify(String("Entrenamiento finalizado."));
}
}
You have to avoid all blocking code. That means the delay, and while statements have to go.
You should use BlynkTimer in Timeout mode. This could either be as a lambda function, or by restructuring your code to have the events that happen once the timer has elapsed in a different function.