Simulate button push from code

ESP32 - Wifi
Android version 11
Blynk server
v 0.6.1

I need to simulate a button push from code. The button is linked to V50.
I want to trigger exactly the code that is fired when i push the button on the app. Is there another (more direct) way to perform this besides putting the code of the BLYNK_WRITE(V50) in a function (and then calling that function from the physical button push and the push simulated from code)?

No, what you’ve described is the best way to do it.

You have a function that performs the task you want, and you call it either from an incoming BLYNK_WRITE trigger or from an interrupt or polling timer attached to your physical pin.

If you want the app button to be synchronised with the physical button then you’d also include a virtualWrite to change the state of the widget.


1 Like

Cool, thanks for the confirmation!