BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

SOLVED! Another LED question - Possibility to create something like an array with led1 Widget definitions?


#1

SOLVED!

Hello agian…

Sometimes I’m a real fool… though with a tool… but still a fool… :crazy_face:

I solved my “Problem”… do know the basic of programming… that you don’t have to ask… :flushed:

Sorry for my poor question. :face_with_hand_over_mouth:

I solve my “problem” with the Blynk.virtualWrite function and a simple int value… :sushing_face:

Sorry again… :wink:

There is nothing to see here :policeman: please go on


Hi folks,

I learned that there are two ways to access/control LED Widgets.

  1. Over LED-Widget definition e.g. WidgetLED led1(V1)
    or
  2. over the e.g. Blynk.virtualWrite(V1, 1024) function.

Now my question:

Is it possible to group one or both possibilitys to group like an array, mybe over a pointer construct?

Like something:

WidgetLED led1(V1);
WidgetLED led2(V2);
WidgetLED led3(V3);

or

Blynk.virtualWrite(V1, 1024);
Blynk.virtualWrite(V2, 1024);
Blynk.virtualWrite(V3, 1024);

to

[type] array_name[] = {led1, led2, led3}

or to

use the Vn values of the Blynk.virtualWrite function for using as a value like String or so on… e.g. like this Blynk.virtualWrite([value for ledn definition], 1024)?!?

This would be create the possibility to access the LEDs in a structure construct like for, if, while… and so on…

I searched about this possibility in the community but didn’t found a answer.
I hope I did not miss the answer… :disappointed_relieved:

THX and kind regards,
André


#2

@magon

do you need something like that ?

Video_00256

void setup()
{
.....
timer.setInterval(50, arrayled);
....
}

void arrayled() {
  if (LedNum == 9) { // 8 LEDs
    LedNum = 1;
    if(OnOff==255){
      OnOff = 0;
    } else {
    OnOff = 255;
  }
  }
   Blynk.virtualWrite(LedNum, OnOff);

  LedNum++;
}

#3

Hi Alexis,

Thank you for your answer.

Yes, this is a great example. Thank you!

Mine is not so perfect but it does almost the same thing.

In the future, I will follow your example.

THX & regards,
André


#4

hope it helps you
:wink: