How to reset my blynk server buttons status when my device is offline?

helo i want to ask if i can reset my blynk server variables whe my devise is offline or with some way lock buttons on my Blynk app because if i press the button when my device is offline and my device connect after some while starts all buttons that i press earlier…Is any way to lock the buttons or reset servers values when device is offline? i’m using an arduino uno with ethernet shlied

>  #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
>  #include <SPI.h>
>  #include <Ethernet.h>
>  #include <BlynkSimpleEthernet.h>
>  char auth[] = " auth code here";
>  const int porta1 = 7;
>  const int porta2 = 3;
>  const int mpagazi =6;
>  const int diakoptis =5;
>  int btn1 = 1;
>  int btn2 = 1;
>  int btn3 = 1;
>  WidgetLED led1 (V2);
>  WidgetLED led2 (V3);
>  WidgetLED led3 (V4);
>  WidgetLED led4 (V5);
>  void setup()
>  {
>    pinMode (porta1, OUTPUT);
>    pinMode (porta2, OUTPUT);
>    pinMode (mpagazi, OUTPUT);
>    pinMode (diakoptis, OUTPUT);
>    digitalWrite (porta1, HIGH);
>    digitalWrite (porta2, HIGH);
>    digitalWrite (mpagazi, HIGH);
>    digitalWrite (diakoptis, HIGH);
>    Blynk.begin(auth);
>  }
>  void loop()
>  {
>   //diakoptis status
>    if (digitalRead (diakoptis) == 0) {
>      led4.on();
>      } 
>     else {
>      led4.off();
>      }
>   // porta1 status
>    if (digitalRead (porta1) == 0 ) {
>      if (btn1 == 1) {
>       led1.on();
>       btn1 = 0;
>    }
>      else if (btn1 == 0){ 
>        led1.off();
>        btn1 = 1;
>    }
>    }
>   //porta2 status
>    if (digitalRead (porta2) == 0 ) {
>      if (btn2 == 1) {
>       led2.on();
>       btn2 = 0;
>    }
>      else if (btn2 == 0){ 
>        led2.off();
>        btn2 = 1;
>    }
>    }
>   //mpagazi status
>     if (digitalRead (mpagazi) == 0 ) {
>      if (btn3 == 1) {
>       led3.on();
>      btn3 = 0;
>   }
>     else if (btn3 == 0){ 
>       led3.off();
>        btn3 = 1;
>   }
>   }
>   
>   Blynk.run();
> }

it’s just blynk code thats just told me when the relays open or closed with a virtual led on my

include???
indentation!!!

1 Like
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

you could perhaps look at the sync utility and blynk.connected() function.

okk thank i’ll try to figure it out :slight_smile: