user35534: I'm working on an led matrix project where I'm running a series of patterns made of bitmap frames.
Here's an example: https://vimeo.com/564184465
Right now I'm using a series of method calls named per pattern to run the animation:
void CSMatrix::runPattern(PATTERNS pattern, uint8_t totalRuns)
{
  for (uint8_t i = 0; i < totalRuns; i++)
  {
    switch (pattern)
    {
    case PATTERN_ZIG_ZAG:
      runPatternSpacedStripes();
      break;
    case PATTERN_ARROW_UP:
      runPatternArrowUp();
      break;
...
    }
  }
}

void CSMatrix::runPatternSpacedStripes()
{
  for (uint8_t i = 0; i < SPACED_STRIPES_LEN; i++)
  {
    renderFrame(SPACED_STRIPES[i]);
    FastLED.show();
    delay(100);
  }
}

void CSMatrix::runPatternArrowUp()
{
  for (uint8_t i = 0; i < ARROW_UP_LEN; i++)
  {
    renderFrame(ARROW_UP[i]);
    FastLED.show();
    delay(100);
  }
}

...

And the bitmaps used to control the matrix pixel states look like this (the functions beneath renderFrame basically say "if it's a 1, use this color, if it's a 0, use that color":
const byte SPACED_STRIPES[][8] = {
    {0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100,
     0b00011000},
    {0b01100011,
     0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100},
...    
};
const int SPACED_STRIPES_LEN = sizeof(SPACED_STRIPES) / 8;

This is working fine, but having a bunch of identical methods to run each pattern is not great.
So, with this working I decided to refactor to make a common runTwoColorPattern method that could accept the pattern frames and the length to run the given pattern:
void CSMatrix::runTwoColorPattern(const byte *frames, const int length, int delayDuration)
{
  for (uint8_t i = 0; i < length; i++)
  {
    renderFrame(frames[i]);
    FastLED.show();
    delay(delayDuration);
  }
}

The problem I'm running into is figuring out how to properly pass the two dimensional array to the function.
I tried updating my switch statement by passing the pointer of SPACED_STRIPES into the runTwoColorPattern:
    switch (pattern)
    {
    case PATTERN_ZIG_ZAG:
      runTwoColorPattern(SPACED_STRIPES, SPACED_STRIPES_LEN, 100);
      //runPatternSpacedStripes();
      break;

But when I do I get the error

argument of type "const byte (*)[8]" is incompatible with parameter of type "const byte *"C/C++(167)


I've found that I can correct this by dereferencing the first item of the multidimensional array, (which would mean I'm passing the memory address to the first pointer element of the multi-dimensional array (I think)), but when I do this the pattern runs backwards and is jittery :|
https://vimeo.com/564184624
I'm not totally sure how to correct this. I'm still fairly new to pointers so I'm sure there's something I'm misunderstanding with passing a pointer for a multi-dimensional array, but I thought what I was passing was basically an address of where to start for the pointer, so I'm not sure why I'm hitting these snags or how to fix it.
Any suggestions?

user4143: A 2D array would be passed as const byte frames[][8]. However you really don't need the complexity of a 2D array - you can do it with a 1D array.
Your array would look like:
const byte SPACED_STRIPES[] = {
     0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100,
     0b00011000,

     0b01100011,
     0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100,
...    
};

And you reference frames within it as a multiple of 8 of the index.  Using your existing code it would look like:
void CSMatrix::runTwoColorPattern(const byte *frames, const int length, int delayDuration)
{
  for (uint8_t i = 0; i < length; i++)
  {
    renderFrame(&frames[i * 8]); // Take the address of the first value of the frame at a multiple of 8
    FastLED.show();
    delay(delayDuration);
  }
}


user7508: The error message is quite explicit:

argument of type "const byte (*)[8]" is incompatible with parameter
of type "const byte *"

If you want to pass SPACED_STRIPES to the method, it is going to be
passed as const byte (*)[8], i.e. pointer to arrays of 8 byte. You
can just set the parameter type accordingly:
void CSMatrix::runTwoColorPattern(
    const byte (*frames)[8], const int length, int delayDuration)
{
    // body unchanged
}


35534: <p>I'm working on an led matrix project where I'm running a series of patterns made of bitmap frames.</p>
<p>Here's an example: <a href="https://vimeo.com/564184465" rel="nofollow noreferrer">https://vimeo.com/564184465</a></p>
<p>Right now I'm using a series of method calls named per pattern to run the animation:</p>
<pre><code>void CSMatrix::runPattern(PATTERNS pattern, uint8_t totalRuns)
{
  for (uint8_t i = 0; i &lt; totalRuns; i++)
  {
    switch (pattern)
    {
    case PATTERN_ZIG_ZAG:
      runPatternSpacedStripes();
      break;
    case PATTERN_ARROW_UP:
      runPatternArrowUp();
      break;
...
    }
  }
}

void CSMatrix::runPatternSpacedStripes()
{
  for (uint8_t i = 0; i &lt; SPACED_STRIPES_LEN; i++)
  {
    renderFrame(SPACED_STRIPES[i]);
    FastLED.show();
    delay(100);
  }
}

void CSMatrix::runPatternArrowUp()
{
  for (uint8_t i = 0; i &lt; ARROW_UP_LEN; i++)
  {
    renderFrame(ARROW_UP[i]);
    FastLED.show();
    delay(100);
  }
}

...
</code></pre>
<p>And the bitmaps used to control the matrix pixel states look like this (the functions beneath <code>renderFrame</code> basically say &quot;if it's a 1, use this color, if it's a 0, use that color&quot;:</p>
<pre><code>const byte SPACED_STRIPES[][8] = {
    {0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100,
     0b00011000},
    {0b01100011,
     0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100},
...    
};
const int SPACED_STRIPES_LEN = sizeof(SPACED_STRIPES) / 8;
</code></pre>
<p>This is working fine, but having a bunch of identical methods to run each pattern is not great.</p>
<p>So, with this working I decided to refactor to make a common <code>runTwoColorPattern</code> method that could accept the pattern frames and the length to run the given pattern:</p>
<pre><code>void CSMatrix::runTwoColorPattern(const byte *frames, const int length, int delayDuration)
{
  for (uint8_t i = 0; i &lt; length; i++)
  {
    renderFrame(frames[i]);
    FastLED.show();
    delay(delayDuration);
  }
}
</code></pre>
<p>The problem I'm running into is figuring out how to properly pass the two dimensional array to the function.</p>
<p>I tried updating my switch statement by passing the pointer of <code>SPACED_STRIPES</code> into the <code>runTwoColorPattern</code>:</p>
<pre><code>    switch (pattern)
    {
    case PATTERN_ZIG_ZAG:
      runTwoColorPattern(SPACED_STRIPES, SPACED_STRIPES_LEN, 100);
      //runPatternSpacedStripes();
      break;
</code></pre>
<p>But when I do I get the error</p>
<blockquote>
<p>argument of type &quot;const byte (*)[8]&quot; is incompatible with parameter of type &quot;const byte *&quot;C/C++(167)</p>
</blockquote>
<p><a href="https://i.stack.imgur.com/6BVVf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6BVVf.png" alt="error" /></a></p>
<p>I've found that I can correct this by dereferencing the first item of the multidimensional array, (which would mean I'm passing the memory address to the first pointer element of the multi-dimensional array (I think)), but when I do this the pattern runs backwards and is jittery :|</p>
<p><a href="https://vimeo.com/564184624" rel="nofollow noreferrer">https://vimeo.com/564184624</a></p>
<p>I'm not totally sure how to correct this. I'm still fairly new to pointers so I'm sure there's something I'm misunderstanding with passing a pointer for a multi-dimensional array, but I thought what I was passing was basically an address of where to start for the pointer, so I'm not sure why I'm hitting these snags or how to fix it.</p>
<p>Any suggestions?</p>
 4143: <p>A 2D array would be passed as <code>const byte frames[][8]</code>. However you really don't need the complexity of a 2D array - you can do it with a 1D array.</p>
<p>Your array would look like:</p>
<pre class="lang-cpp prettyprint-override"><code>const byte SPACED_STRIPES[] = {
     0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100,
     0b00011000,

     0b01100011,
     0b11000110,
     0b10001100,
     0b00011000,
     0b00110001,
     0b01100011,
     0b11000110,
     0b10001100,
...    
};
</code></pre>
<p>And you reference frames within it as a multiple of 8 of the index.  Using your existing code it would look like:</p>
<pre class="lang-cpp prettyprint-override"><code>void CSMatrix::runTwoColorPattern(const byte *frames, const int length, int delayDuration)
{
  for (uint8_t i = 0; i &lt; length; i++)
  {
    renderFrame(&amp;frames[i * 8]); // Take the address of the first value of the frame at a multiple of 8
    FastLED.show();
    delay(delayDuration);
  }
}
</code></pre>
 7508: <p>The error message is quite explicit:</p>
<blockquote>
<p>argument of type &quot;const byte (*)[8]&quot; is incompatible with parameter
of type &quot;const byte *&quot;</p>
</blockquote>
<p>If you want to pass <code>SPACED_STRIPES</code> to the method, it is going to be
passed as <code>const byte (*)[8]</code>, i.e. pointer to arrays of 8 <code>byte</code>. You
can just set the parameter type accordingly:</p>
<pre class="lang-cpp prettyprint-override"><code>void CSMatrix::runTwoColorPattern(
    const byte (*frames)[8], const int length, int delayDuration)
{
    // body unchanged
}
</code></pre>
