Programmatically change properties

This is my code…

for (byte i = 0; i < 8; i++) {
  Blynk.setProperty(i, "label", myProperties[i].caption);    
  Blynk.setProperty(i, "onlabel", myProperties[i].ON_descr); 
  Blynk.setProperty(i, "offlabel", myProperties[i].OFF_descr); 

How I can address virtual pin on setProperty like the code before?

Sorry, I do not understand your question.

That should work, but your properties thing has to be a String:


I think …

And unless Blynk have updated their code recently it is likely to crash your hardware as any more than 2 or 3 consecutive setProperties doesn’t work, so 24 will cause mayhem.

My question is… how I can address my variable i to point virtual pins…

  Blynk.setProperty(V0, "label", myProperties[i].caption);    
  Blynk.setProperty(V0, "onlabel", myProperties[i].ON_descr); 
  Blynk.setProperty(V0, "offlabel", myProperties[i].OFF_descr); 

how I can implement an iteration in the for cycle from V0 to V8, substituting V0,V1,V2… and so on with an iter variable like “i”.

I think you can use integers there, but mostly I like to use “V0” so I have a visual indicator I’m dealing with a virtual pin, but since setProperty only works with virtual pins… have you tried that?

My code cause crashes of the hardware, so I thought that V0 (V1, V2 and so on…) isn’t replaceable with integer, but … maybe the crash is due to the problem that @Costas refers; and my code would work…

@naamah75 I believe the problem is covered on Github.

To test your code try 0 < 2 and just one setProperty in the loop.

Changing properties cause crashes and the end of the world also with 1 only call of setProperty.

is there a fix planned for the setPropery causing Blynk app to crash ? @Dmitriy

Yes. Work in progress.

Blynk.setProperty(VIR_PIN_NUMBER, “labels”, String(“give the variable here”));

@qkarthi please check timedate stamps before posting… this is the 2nd OLD topic you have replied to in the last few minutes :wink: