Intruder alert notification blynk 2.0

You are calling your ultrasonic() function in your void loop, and that function contains this line of code:

This is the same as putting that Blynk.virtualWrite() command directly into your void loop, and this breaks the golden rule of Blynk - no Blynk.virtualWrite() commands in the void loop.

I’ve already pointed you to the documentation which explains why this is a really bad idea in your previous topic…

so, once again, DO NOT RUN THIS CODE! it will flood the Blynk server with far too many Blynk.virtualWrites per second.

You need to call your your ultrasonic() function with a BlynkTimer, not from the void loop.

You will also need to use a “Flag” variable so that you only send one notification each time the level falls below 5cm, otherwise you will quickly run out of notifications as they are limited to 100 per 24 hour period. You should read this for more information…

Pete.