jperez
1
when working with a virtual pin loop, the input works but when leaving it disconnects from blynk
BLYNK_WRITE(V1)
{
int Estado_Alarma = param.asInt();
if (Estado_Alarma == 0)
{
do
{
digitalWrite(13, HIGH);
}
while (Estado_Alarma != 0);
digitalWrite(13, LOW);
}
}
1 Like
I would not use a do while loop as it is blocking. Does the pi really need to be continuously set? Why not just the if statement?
1 Like
int Estado_Alarma;
timer.setInterval(2000L, EstadoAlarma );
void EstadoAlarma() {
if (Estado_Alarma == 0)
{
digitalWrite(13, HIGH);
}else{
digitalWrite(13, LOW);
}
BLYNK_WRITE(V1)
{
Estado_Alarma = param.asInt();
}
2 Likes
jperez
4
Excelent,
Thank you very much for the help
2 Likes
You could also try:
BLYNK_WRITE(V1)
{
digitalWrite(13, !param.asInt());
}
2 Likes
You are the best @JustBertC
2 Likes