I need to run a function whenever the app connects to the server, rather than constantly sending information which is not looked at.
I am using an ESP8266 1Mb Flash, it connects to wifi without any problem. I just want the ESP to know if an app is connected to it.
So when the project, on the iPhone in my case, starts, can I get a function to run, and have it update all pins ? If the app is not connected then don’t bother sending any BLYNK.virtualRead() methods.
Ha… unintentional, but hopefully influential, tag team response.
BTW, this is not a valid command But a BLYNK_READ() function with a corresponding Widget set to a reading rate generally only works when App is active.
As it is a single long web page, search is a function of the browser itself
Blynk.run() handles all sorts of internal housekeeping… as far as I know it is required to run most Blynk commands ONCE connected…
But as far as connection commands/functions, I think they will run as called, otherwise the example sketch I wrote wouldn’t work.
Is there any particular reason you want such restrictions? As an IoT process, which Blynk is, the server would normally be connected to the device at all times (regardless whether App is active or not) and recording all action… essential for features like charting, API, etc.
And as for the BLYNK_APP_CONNECTED() function itself… it will run ONCE, every time the device detects the APP connection (I think this means when App is Active… aka primary on-screen, but it could also mean when running in background). I also suspect this requires the device to be fully connected to the server and Blynk.run() in the loop.