Hi Dimitriy, I use IOS 9.2.1.
In the meantime I have read about State Syncing (link to the relevant sections on docs.blynk.cc). There you distinguish between âFor hardwareâ and âFor appâ.
If I understand, the former would be to re-set hardware, e.g. pin states, according to what is set (ârememberedâ) by the app. So, in my case, this would not apply, since the âapp-sideâ seems to forget what states the hardware side was in.
The description of the âFor appâ seems to apply to my problem, i.e. the app not showing the actual hardware/pin states after the app had been turned off. So apparently I need to use a Blynk.virtualWrite call for each state that is shown in the app in order to re-set the actual states there. This brings me to the following questions.
(1) Letâs assume the app had been closed or turned off, or the app/dashboard has been opened on a different phone. How does the hardware side âknowâ when to make the (series of) Blynk.virtualWrite calls, in other words, how does the hardware side get to know when the app has been re-started or the same dashboard has been opened on another device?
(2) For the moment my app uses eight momentary push buttons and seven LED widgets. This means that in this setting I already would need to update 15 button states. In what frequency can I make Blynk.virtualWrite calls? Would it be feasible to have something like that?
void SynchStates() {
if (digitalRead(pin1) = HIGH) LED1.on() else LED1.off(); // for the LED widgets
if (digitalRead(pin2) = HIGH) LED2.on() else LED2.off();
...
...
if (digitalRead(pin14) = HIGH) Blynk.virtualWrite(V14, HIGH) else Blynk.virtualWrite(V14, LOW); // for the button/switch widgets
if (digitalRead(pin15) = HIGH) Blynk.virtualWrite(V15, HIGH) else Blynk.virtualWrite(V15, HIGH);;
}
If this is the intended use described in the âFor appâ section, can I make 15 consecutive âBlynkâŚâ calls, i.e. directly one after the other without any delay between them, and by this not causing a âFlood Errorâ (making too many calls in a given time frame).
(3) For the moment I am often combining push-type buttons with an LED widget to indicate the corresponding status on the hardware side. The combination button/LED widget is necessary because in parallel with the software buttons in the app I have hardware buttons actuating a particular state on the hardware side. Therefore, I have the LED to indicate the actual state which might have changed through a hardware button press (therefore, the âcomboâ widget of a button and an LED, as proposed elsewhere in the forum, makes absolutely sense). Could I use instead a switch-type button in the app, and use a âBlynk.virtualWrite(Vxx, HIGH/LOW)â call (e.g. whenever a hardware button is pressed) in order to set the button state in the app, which would then reflect the actual state on the hardware side? by this way, the accompanying LED widget would not be necessary anymore, saving me both a virtual pin plus precious space on the app screen?