Cheking button state

Hi i have a problem. i need to check the state of a button (V2). if its on than println “button is pressed” else println "button is off anny help with esp32 board ???

The BLYNK_WRITE(V2) callback function will trigger whenever the state of the widget attached to V2 is changed.
So, the solution is to capture the value of V2 whenever it changes and store its latest value in a global variable.

Read this for more info on the details…


thank for your reply
i m struguling to assign the value of the Button to the global variable
does the variable type is int ???
because this syntax doesnt work

int v;

You should read the link I provided.


thanks a lot that was really helpful for me