How to run the ultrasonic sensor while the button Blynk V2 is pressed?

Hello… in answer to your titled question… First you read the prerequisite Welcome Topic…

Then go back and edit your first post to properly format your posted code…

Blynk%20-%20FTFC

Next, read the Help Files for proper ways to code with Blynk (hint, your current void loop() is bad for Blynk)…

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/keep-your-void-loop-clean

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/how-to-control-anything-with-blynk-app

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/how-to-display-any-sensor-data-in-blynk-app

Then search this forum for keywords like ultrasonic… (hint I have a topic full of examples, including one for ultrasonic)…

https://community.blynk.cc/search?q=ultrasonic%20sensor

And finally, read those articles, try out the examples and have fun learning :wink:

2 Likes