user79519: Disclaimer: I just started using C++ and I'm a bit of a beginner. Keep that in mind as your answering.
So I recently bought my first Arduino. It's a customized one and it has an 8x8 display attached to it. To display something on the display, the company I bought it from recommends storing the instructions for the display in a two-dimensional byte array.
I now have a longer animation I want it to play, so I researched and found PROGMEM which lets me store much more data. So I write something along the lines of:
const byte frames[2][8] PROGMEM {
  {
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
  },
  {
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
  }
};

void setup() {
  arduino.begin();
}

void loop() {
  arduino.printImage(frames[0]);
  delay(1000);
  arduino.printImage(frames[1]);
  delay(1000);
}

After compiling, it throws a few errors at me:
warning: invalid conversion from 'const byte* {aka const unsigned char*}' to 'byte* {aka unsigned char*}' [-fpermissive]
   arduino.printImage(frames[0]);
                      ~~~~~~~~^

This did not worry me as much and I just ignored those. After uploading, however, the display just showed arbitrary patterns instead of the lines I told it to draw.
After I removed the PROGMEM, it worked flawlessly, however, the memory wasn't big enough to store the array (not the one I provided as an example).
I could think of two reasons:

In the official documentation of PROGMEM, it states that you have to get the variables back into memory. However, none of the methods they provided worked for me.
In a similar question on ASE, both answer and comments state that nested arrays aren't supported, but my knowledge of C++ isn't good enough to understand the answer.


user7508: On the question you are referencing, the accepted answer suggests
to modify the library. This could be the most efficient option. A less
invasive solution, however, would be to copy the data from the flash
memory to RAM, and use the printImage() function as is.
Obviously, copying everything to RAM defeats the purpose of PROGMEM. But
you only need to copy one frame at a time, and only hold it in memory
for little more than the duration of the call to printImage():
void printProgmemFrame(const byte flashFrame[8]) {
  byte ramFrame[8];
  memcpy_P(ramFrame, flashFrame, 8);
  arduino.printImage(ramFrame);
}

void loop() {
  printProgmemFrame(frames[0]);
  delay(1000);
  printProgmemFrame(frames[1]);
  delay(1000);
}


79519: <p><strong>Disclaimer:</strong> I just started using C++ and I'm a bit of a beginner. Keep that in mind as your answering.</p>
<p>So I recently bought my first Arduino. It's a customized one and it has an 8x8 display attached to it. To display something on the display, the company I bought it from recommends storing the instructions for the display in a two-dimensional byte array.</p>
<p>I now have a longer animation I want it to play, so I researched and found <a href="https://www.arduino.cc/reference/en/language/variables/utilities/progmem/" rel="nofollow noreferrer">PROGMEM</a> which lets me store much more data. So I write something along the lines of:</p>
<pre class="lang-c prettyprint-override"><code>const byte frames[2][8] PROGMEM {
  {
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
    B10000100,
  },
  {
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
    B10010100,
  }
};

void setup() {
  arduino.begin();
}

void loop() {
  arduino.printImage(frames[0]);
  delay(1000);
  arduino.printImage(frames[1]);
  delay(1000);
}
</code></pre>
<p>After compiling, it throws a few errors at me:</p>
<pre class="lang-c prettyprint-override"><code>warning: invalid conversion from 'const byte* {aka const unsigned char*}' to 'byte* {aka unsigned char*}' [-fpermissive]
   arduino.printImage(frames[0]);
                      ~~~~~~~~^
</code></pre>
<p>This did not worry me as much and I just ignored those. After uploading, however, the display just showed arbitrary patterns instead of the lines I told it to draw.</p>
<p>After I removed the PROGMEM, it worked flawlessly, however, the memory wasn't big enough to store the array (not the one I provided as an example).</p>
<p>I could think of two reasons:</p>
<ol>
<li>In the <a href="https://www.arduino.cc/reference/en/language/variables/utilities/progmem/" rel="nofollow noreferrer">official documentation of PROGMEM</a>, it states that you have to get the variables back into memory. However, none of the methods they provided worked for me.</li>
<li>In a <a href="https://arduino.stackexchange.com/questions/63178/read-nested-array-item-from-progmem">similar question on ASE</a>, both answer and comments state that nested arrays aren't supported, but my knowledge of C++ isn't good enough to understand the answer.</li>
</ol>
 7508: <p>On <a href="https://arduino.stackexchange.com/questions/63178">the question you are referencing</a>, the accepted answer suggests
to modify the library. This could be the most efficient option. A less
invasive solution, however, would be to copy the data from the flash
memory to RAM, and use the <code>printImage()</code> function as is.</p>
<p>Obviously, copying everything to RAM defeats the purpose of PROGMEM. But
you only need to copy one frame at a time, and only hold it in memory
for little more than the duration of the call to <code>printImage()</code>:</p>
<pre class="lang-cpp prettyprint-override"><code>void printProgmemFrame(const byte flashFrame[8]) {
  byte ramFrame[8];
  memcpy_P(ramFrame, flashFrame, 8);
  arduino.printImage(ramFrame);
}

void loop() {
  printProgmemFrame(frames[0]);
  delay(1000);
  printProgmemFrame(frames[1]);
  delay(1000);
}
</code></pre>
