I use more than 2 buttons when one button state change, Arduino run BLYNK_WRITE of the button.
but I need another button state.
so can I use like BLYNK_WRITE in void loop? to read other button states.
or there is another way to read button state?
ps. Sorry, my native language is not English, so the sentence may be poor, but I hope it is well communicated.
No! You certainly can’t do that.
Each button that attached to a virtual pin can have a corresponding BLYNK_WRITE function in the code.
If you want to know what the state of each button is from within the code then the neatest way is to use a global variable for each function, as a sort of flag, to track the state of each button.
If you want some logic that, when one button is pressed checks the state of other buttons to decide what action to take, then it’s simply a case of checking what the current values of these flag variables are.
If you want to load the values of those buttons when your MCU starts up then you can use the BLYNK_CONNECTED function to call a Blynk_syncVirtual() command for each of the buttons (don’t try to do a syncAll, it’s not a good idea).
Thank you! I tried Blynk_syncVirtual()! and it warks!