Hi
I has a code
void Update_state() { if (timer.isEnabled(Timer_Socket_1_id)) { Blynk.virtualWrite(V12, 1); } else { Blynk.virtualWrite(V12, 0); } delay(5); if (timer.isEnabled(Timer_Socket_2_id)) { Blynk.virtualWrite(V13, 1); } else { Blynk.virtualWrite(V13, 0); } delay(5); if (timer.isEnabled(Timer_Socket_3_id)) { Blynk.virtualWrite(V15, 1); } else { Blynk.virtualWrite(V15, 0); } delay(5); if (timer.isEnabled(Timer_Socket_4_id)) { Blynk.virtualWrite(V16, 1); } else { Blynk.virtualWrite(V16, 0); } delay(5); if (digitalRead(Socket_1_Pin) == HIGH) { Blynk.virtualWrite(V2, 1); } else { Blynk.virtualWrite(V2, 0); } delay(5); if (digitalRead(Socket_2_Pin) == HIGH) { Blynk.virtualWrite(V3, 1); } else { Blynk.virtualWrite(V3, 0); } delay(5); if (digitalRead(Socket_3_Pin) == HIGH) { Blynk.virtualWrite(V5, 1); } else { Blynk.virtualWrite(V5, 0); } delay(5); if (digitalRead(Socket_4_Pin) == HIGH) { Blynk.virtualWrite(V6, 0); } else { Blynk.virtualWrite(V6, 1); } delay(5); terminal1.print("All state updated"); terminal1.println(); terminal1.flush(); }
this code use to update value of hardware to app, because my hardware sometime still working but not connect to Blynk server, so I write a code like this and set interval or put in BLYNK_CONNECTED().
I care about many virtualWrite call in time, is there anyway to read a value of VirtualPin, than compare with value of hardware, if difference than call virtualWrite? or some way else to avoid flood server or make my nodeMCU hang?