Turn On / Off multi Virtual Leds

WidgetLED led_zone_1(V41);
WidgetLED led_zone_2(V42);
WidgetLED led_zone_3(V43);
WidgetLED led_zone_4(V44);
WidgetLED led_zone_5(V45);
WidgetLED led_zone_6(V46);
WidgetLED led_zone_7(V47);
WidgetLED led_zone_8(V48);

I don’t want to do :
How i can do it with loop ?? How i can reference variable with string ?

Example: led_zone_[i]

Instead of the dedicated WidgetLED commands, I use this generic vPin type of processing for my multi-virtual LED projects

Blynk.virtualWrite(i, 255); // Set LED to full intensity

For example, to turn all 72 of them “simulated off”, AKA all black… True off would be setting them to 0 for the value.

for (int i = 0; i <= 71; i++) {
    Blynk.setProperty(i, "label", " ");  // Set LED Label to blank
    Blynk.setProperty(i, "color", "#000000");  // Set LED colour to black
    Blynk.virtualWrite(i, 255);  // Set LED to full intensity

Hmm not bad idea :slight_smile:
I will try it !


Update: SOLUTION ACCEPTED!!! :slight_smile:

1 Like