0

im working with an arduino attached with 6 LED programmable strips and the FASTLED library. for animations i need to efficiently pass data to methods to create easy animations.

the leds are in a grid of 6 X 30, and the only way to light them is to specify the strip and the index on that strip.

i currently have this piece of code to pass the strip and leds through easily:

//i want to pass the data through as this: setArrayLeds(   [{1,4,5,6},{2,4,5,6}] );
//where the first index per array is the led strip, the latter the leds.

void setArrayLeds(int list[]){
    for(int i = 0; i < list.size(); ++i){

       int led[] = list[i];

       for(int j = 1; j < led.length(); j++){

          //array with ledstrip individally assignable
          ArrayOfLeds[led[0]][led[j]].setRGB(255,0,0);

        }

      }
}

but even better option would be to use maps to pass data around, such as this code

setMapsLeds( map containing > 1:{1,2,3,4}, 2:{5,6,7}, 3:{8,9,10});

where a function will iterate over the keys and light the corresponding leds on the right ledstrip.

do you guys have any idea how to make this possible

Joel Spolsky
  • 33,372
  • 17
  • 89
  • 105
Igor D
  • 108
  • 2
  • 12

0 Answers0