GPIO State getting stuck

Hi, I have a simple project consist of one button to control my auto gate. My issue here is when I press down the button and somehow connection loss in my phone, the GPIO state won’t auto turn off and it get stuck to ON until i press the button again.

Maybe I do not fully understand what you mean, but a button can have two modes: push or switch. In Switch mode the button stays ON until pressed again, then it turns to OFF. In Push mode the button stays ON as long as the button is pressed, and goes to OFF as the button is released.

You can changes this mode in the settings of the button.

I hope this is any help for you.

I am using the push mode, if my connection lost while I am holding the button the gpio state get stuck

Do you use the Blynk.sync() function in your sketch? Could you post the code? It may make it more easy to determine where it goes wrong :slight_smile:

I think the connection is the problem. The release of the button (value ‘0’) is not send to your board if there is no connection. You say that you lose connection while pressing the button, so the conencted pin gets value HIGH wheb you press the button, then your connection is lost, then you release the button, but the value LOW cannot be sent because there is no connection.

I didn’t write any code, it just works out of the box (simple button triggering gpio pin)

Exactly, is there any way to reset gpio state after certain period?

I dont think that is possible if you control the gpio pins directly. If you use virtual pins you can make a sketch/code and use the function that Lichtsignaal mentoined: Blynk.sync() to sync the state between your board and the app

But the best thing to do is to get your connection more stable, it is about IoT, connected things, so the connection is very important :wink: