I’m struggling with a code ‘effenciency’ issue, I have about 30 on/off inputs. Each is processed through the exact same set of criteria and responded to identically changing property settings. But, the set property commands have these peskey pin references that dont seem to be dynamic. See the current code.
Blynk.setProperty(V30,"offLabel","Door 5 OPEN"); // warn condition
Blynk.setProperty(V30,"offBackColor","#FF0000"); // Background color red
The strings are easy. Whats not so easy is how to handle the virtual pin number, Ideally i’d like to do something like this.
Blynk.setProperty(V[i],propertyLabelString[i],condtionString[i]); // warn condition
Blynk.setProperty(V[i],propertyBackColorString[i],conditionBackColorString[i]); // Set Background color
If i can do this, it will prevent me from having to replicate 9, 30 level switch/case statements.
The Closest I can come is a big tall switch/case statement with the following.
Just seems wasteful…
void SetPropIdx(int i,String propString1, String propString2)
These commands only relate to virtual pins.
If you want to change the state of a digital pin then it’s a standard C++ digitalWrite() command and the Blynk library does the rest.
I guess the same for Analogue pins, but I’ve never tried that.