How to initialize multidimensional array and use it?

What I'm trying to do is, I make multiple arrays that store the brightness of each Leds. They are like sprites for an animation. Then I would cycle through the values of each set of arrays for each 'frame' of led animation.
So what I'm trying is:
Say, I want to make an alternating pattern with leds like christmas lights.
I was thinking of making multiple arrays (this is just an example)

{50, 0, 50, 0, 50, 0, 50}
{0, 50, 0, 50, 0, 50, 0}
{100, 0, 100, 0, 100, 0}
{60, 70, 30, 60, 70, 30}

like so, then cycle those values across an led strip with 7 leds to animate.
This one would be making leds brighter. (still just a crude example)

{0, 0, 0, 0, 0, 0, 0}
{20, 20, 20, 20, 20, 20, 20}
{100, 100, 100, 100, 100, 100}
{255, 255, 255, 255, 255, 255}

Here's what I have and it compiles fine but when I do a test Serial.print of one of value in the array, nothing shows up. LED strip doesn't work either.

#include "FastSPI_LED2.h"

#define NUM_LEDS 24
#define DATA_PIN 12

CRGB leds[NUM_LEDS];
uint8_t valarray[100][NUM_LEDS]; 

void setup()
{
  delay(2000);

  LEDS.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
  Serial.begin(9600);


  for(uint8_t i=0;i<100;i++){
    for(uint8_t j=0;j<NUM_LEDS;j++){
      valarray[i][j] = i;
    }
  }

}

void loop()
{

for(uint8_t i=0;i<100;i++){
    for(uint8_t j=0;j<NUM_LEDS;j++){
      leds[j]=CHSV(0,255,valarray[i][j];
    }
    LEDS.show();
  }

  delay(10);
}

What Arduino do you have?
You have an array of 100 by 24, this is 2400 bytes. A Uno has only 2K to store everything so you might be running short.
Why not initialise the array with the values you need like this:-

 byte radarConv[12][4] = {
                   // angle 0
                   34, 33, 32, 31,
                   // angle 1
                   49, 40, 63, 63,
                   // angle 2
                   60, 54, 47, 39,
                   // angle 3
                   58, 46, 63, 63,
                   // angle 4
                   56, 51, 45, 38,
                   // angle 5
                   43, 37, 63, 63,
                   // angle 6
                   26, 27, 28, 29,
                   // angle 7
                   11, 20, 63, 63,
                   // angle 8
                   0, 6, 13, 21,
                   // angle 9
                   2,  14, 63, 63,
                   // angle 10
                   4,  9, 15, 22,
                   // angle 11
                   17, 23, 63, 63                  
                      };

This bit of code is from my Hexome project, but it shows you how to initialise a two dimensional array.

You can also write

byte radar[12][4]= { { 1,2,3,4}, {1,2,3,4}, {1,2,3,4}, {1,2,3,4}, {1,2,3,4}, {1,2,3,4},
                               {1,2,3,4}, {1,2,3,4}, {1,2,3,4}, {1,2,3,4}, {1,2,3,4}, {1,2,3,4} } ;

Apparently the inner { } are optional, but most textbooks have them.

I prefer the additional {} as it shows the structure better and allows you to do the following trick

//
//    FILE: multiDimArray.ino
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.00
// PURPOSE: demo
//    DATE: 2014-01-04
//     URL:
//
// Released to the public domain
//

byte radar[8][4]= { { 1,2}, {1,2,3}, {1,2,3}, {}, {}, {1}, {1,2,3,4}, {1,2,3,4} } ;

void setup() 
{
  Serial.begin(115200);
  Serial.println("Start ");

  for (int i=0; i<8; i++)
  {
    for (int j=0; j<4; j++)
    {
      Serial.print(",");
      Serial.print(radar[i][j], DEC);
    }
    Serial.println ();
  }
}

void loop() {}

int cube_matrix[3][3][3] = {

{{0,1,2},// row 0
{3,4,5},
{6,7,8}},

{ {9,10,11},
{12,13,14},
{15,16,17}},

{{18,19,20},
{21,22,23},
{24,25,26}}

};

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
// put your main code here, to run repeatedly:
for (int i=0;i<3;i++){
for (int j=0;j<3;j++){
for(int k=0;k<3;k++){

Serial.println(cube_matrix*[j][k]);*

  • delay(1000);*
    }
    }
    }
    }

david_2018:
I'm not familiar with the library you are using for drive the leds

You're replying to a 5 year old post :smiley:

Gilberto_Gozzi:
...
...

And, what is the problem? Or is it a solution to a 5 year old problem.

Further, please read How to use this forum - please read., specifically point #7 about posting code so that the forum software does not bugger up your code.