Hello everyone, I would like to implement a project in which I control an actuator, say a lamp, with both a hardware button (linked to a digital pin of an Arduino) and a software button in the Blynk app (used on more than one device). Ideally, the state of the actuator (e.g. lamp on or off) should be trackable also in the app when I change the state (switch on or off) through the hardware button. In other words, if ,for example, I switch on the lamp by the software switch on the Blynk app (linked to a virtual pin) I have a representation of the actuator state from the switch state. Now I want to track also the actual state in the Blynk app in the case when the actuator state is changed by the hardware button/switch (e.g. the lamp that has been switched on through Blynk gets switched off by the hardware button, or vice versa), if I re-open the Blynk app, I would like the software switch to reflect the actual lamp state, also if this has been changed with the hardware button.
What would be the most elegant way of implementing that?
I could think of a solution using two virtual pins for this, one tracking the state (e.g. on/off and displaying that via an LED widget in the app) and the second one for the actual button (in this case a push button in the Blynk app) and the Arduino code then toggles the actuator based on the actual state (i.e switches the lamp of when it is on and vice versa). However, it would be more elegant to use just one widget with just one Virtual pin on which the Blink switch (instead of a push button) is hooked. Can I set/update from the Arduinio side the state of the virtual pin in such a way that when I open the Blynk app, the switch shows me whether the lamp is on or off regardless how this state was set?