32x16 WS2812 FastLED.h Memory Problem

Hello!

First time posting on an arduino Forum like this. I apolagize for any mistakes I might make. I'm working on a project using an Arduino Mega 2560, WS2812 Leds and the FastLED.h library. Its a 32x16 LED Matrix that uses 512 LEDs. A simple display test takes 22% of the Dynamic Memory. My guess is my issue has something to do with memory or buffer or heap size (concepts I only have a vaque understanding of).

To be clear I've managed to successfully power and control the LEDs in general. I'm having specifc issues when I try to create animated pixel art. I can get up to 8 frames of animation to play but once I try and do 9 frames of animation there seems to be some sort of fundamental issue with the SRAM which I'm trying to work around.

I attempted to use some info I found here: https://docs.arduino.cc/learn/programming/memory-guide#buffer-size-control
Which is where the PROGMEM comes from on line 40. Lines 41-49 (49 is commented out to make the code work) each represent one frame of the animation. The animation is 16x8 pixels in display size and 9 frames long. It's the duck running across the screen.

It work with 8 frames (one frame must be commented out, doesn't matter which frame) but not with 9 frames. If I uncoment that line (line 47) and update the NUM_FRAMES accoringly the arduino "stops" during startup (or at least the serial communication stops). It doesn't continually reset and when I was messing around moving where birdPxf was initialized it woulds somtimes display a "messed up" version of the animation.

At the end of the day I'm pretty sure the issue has to do with the large 4D array and I'm kind of wondering if maybe I need to define the array in a different scope and then access it in a function in a different way. I would also be happy for an explination of what's going on and how could improve this code anyway. I'm a second year computer engineering major and this is a personal project.

Thanks in advance for the help!

Here's the code:

#include <FastLED.h>
#include <avr/pgmspace.h>

#define LED_PIN     3
#define NUM_LEDS    512
#define NUM_FRAMES  8


CRGBArray<NUM_LEDS> leds;


void setup() {

  Serial.begin(9600);
  Serial.println(F("here"));

  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(100);

  FastLED.clear();
  FastLED.show();

  delay(1000);
  Serial.println(F("here2"));
}

void loop() {
  //updatePxArt(16, 16, 8, 0, birdPx);
  for (int k = 0; k <= NUM_FRAMES-1; k++){
    writeBirdFrame(k);
    delay(100);
    Serial.println(k);
  }
}

void writeBirdFrame(uint8_t frame){
  FastLED.clear();

  //frames, height(#of 16 px rows), width(16 px), pixels (3 colors)
  const PROGMEM uint8_t birdPxf[NUM_FRAMES-1][8][16][3] = {
    {{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 254, 254}, {1, 1, 1}, {254, 254, 252}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {239, 127, 68}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {239, 127, 68}, {239, 127, 68}, {239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
    {{{0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {222, 221, 210}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{239, 127, 68}, {239, 127, 68}, {255, 254, 254}, {1, 1, 1}, {254, 254, 252}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {222, 221, 210}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}}, {{1, 1, 1}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}}, {{0, 0, 0}, {209, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{209, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {209, 108, 56}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
    {{{0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{222, 221, 210}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{239, 126, 67}, {255, 254, 254}, {1, 1, 1}, {255, 254, 254}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 126, 67}}, {{222, 221, 210}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}}, {{222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {239, 126, 67}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {239, 126, 67}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {239, 126, 67}, {239, 126, 67}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
    {{{222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}}, {{255, 254, 254}, {1, 1, 1}, {254, 254, 252}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}}, {{255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0}, {222, 221, 210}}, {{222, 221, 210}, {222, 221, 210}, {239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {1, 1, 1}, {222, 221, 210}}, {{0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}}, {{0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
    {{{222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}}, {{255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 254, 254}}, {{1, 1, 1}, {255, 254, 254}, {255, 254, 254}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 254, 254}}, {{255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 254, 254}}, {{222, 221, 210}, {239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}}, {{0, 0, 0}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}}, {{239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {239, 127, 68}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
    {{{222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}}, {{255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}}, {{255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 255, 255}, {1, 1, 1}}, {{255, 255, 255}, {255, 255, 255}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {239, 127, 68}, {255, 255, 255}}, {{239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {239, 127, 68}, {239, 127, 68}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}, {0, 0, 0}}},
    {{{222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}}, {{255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}}, {{255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 255, 255}, {1, 1, 1}, {255, 255, 255}}, {{255, 255, 255}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {239, 127, 68}, {255, 255, 255}, {255, 255, 255}}, {{222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {239, 127, 68}, {239, 127, 68}, {239, 127, 68}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}}},
    {{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}}, {{222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}}, {{222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 254, 254}, {1, 1, 1}, {254, 254, 252}, {255, 254, 254}}, {{254, 254, 252}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}, {255, 254, 254}}, {{222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {239, 127, 68}, {222, 221, 210}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}, {239, 127, 68}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {239, 127, 68}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
    //{{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 255, 255}, {1, 1, 1}, {255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {1, 1, 1}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}},
  };

  const PROGMEM uint8_t lastFramebirdPxf[8][16][3] = {{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 255, 255}, {1, 1, 1}, {255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {1, 1, 1}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}};

  if(frame<8){
    for (int j = NUM_FRAMES-1; j >= 0; j--){
      for (int i = 0; i <= 15; i++) {
        leds[XY(i+8, 7-j)] = CRGB ( birdPxf[frame][j][i][0], birdPxf[frame][j][i][1], birdPxf[frame][j][i][2]);
      }
    }
  }
  else{
    for (int j = 7; j >= 0; j--){
      for (int i = 0; i <= 15; i++) {
        leds[XY(i+8, 7-j)] = CRGB ( lastFramebirdPxf[j][i][0], lastFramebirdPxf[j][i][1], lastFramebirdPxf[j][i][2]);
      }
    }
  }

  FastLED.show();
}

uint16_t XY(uint8_t x, uint8_t y)
{
  if(0<=x && x<=31 && 0<=y && y<=15){
    uint16_t i;
    //check for first or second matrix 
      //&0x01 checks if odd
    bool addAtEnd = false;
    if (x>15){
      x -= 16;
      addAtEnd = true;
    }
      if(y & 0x01){
        // Even rows run backwards
        uint8_t reverseX = 15 - x;
        uint8_t reverseY = 15 - y;
        i = (reverseY * 16) + reverseX;
      } 
      else {
          // odd rows run forwards
        uint8_t reverseY = 15 - y;
        i = (reverseY * 16) + x;
      }
      if(addAtEnd){
        i+=256;
      }
      /*
      Serial.print("x: ");
      Serial.print(x);
      Serial.print(" y: ");
      Serial.print(y);
      Serial.print(" i: ");
      Serial.println(i);*/
      return i;
  }
  else{
    //Serial.println(" bad val");
    return NUM_LEDS;
  }
}

Here's the poorly made python script that turns the gif into an array that the arduino can use if you're curious.

import cv2
import numpy as np
from PIL import Image

if __name__ == "__main__":
    
    
    def main():
        #input manually
        heightPx = 16
        widthPx = 16
        
        
        frames = []
        numFrames = 0
        
        with Image.open("Duck2.gif") as im:
            im.seek(1)  # skip to the second frame

            try:
                while 1:
                    im.seek(im.tell() + 1)
                    data = np.array(im)
                    for i in range(len(data)):
                        for j in range(len(data[i])):
                            data[i][j] = data[i][j][:3]
                    data = data.tolist()
                    frames.append(createPxFrame(data))
                    numFrames+=1

            except EOFError:
                pass  # end of sequence
        
        print(f"uint8_t birdPxf[{numFrames}][{widthPx}][{heightPx}][3] = {{")
        
        for frame in frames:
            myStr = str(frame)
            myStr = myStr.replace("[","{")
            myStr = myStr.replace("]","}")
            print(myStr+",")
        
        print("};")
        
    def createPxFrame(data):
        newData = []
        
        #Each large pixel is 20 png pixels
        for i in range(len(data)):
            #320 times for outside of loop with 16 height pixel image
            if (i%10 == 0) and (i%20 != 0):
                tempData = []
                for j in range(len(data[i])):
                    #640 times for inside of loop with 32 pixel image
                    if (j%10 == 0) and (j%20 != 0):
                        tempData.append(data[i][j])
                        #print(len(tempData))
                newData.append(tempData)
                #print(len(tempData[:][-1:]))
        
        return newData
            
    main()

Here's the gif in question:
Duck2

Here's What's currently running on the display (you can see it skip a frame):
duckDisplayed1

I've got some other parts to this project as well (such as multiple arduinos, inputs, and an OLED display communicating over I2C) but they're not connected or being touched in this code.

Probably a good option later on would to be to use an SD card module and store the pixel art on that but I probably should figure out this issue first.

        leds[XY(i + 8, 7 - j)] = CRGB (
                           pgm_read_word_near(birdPxf + frame * 8 * 3 * 16),
                           pgm_read_word_near(birdPxf + frame * 8 * 3 * 16 + 1),
                           pgm_read_word_near(birdPxf + frame * 8 * 3 * 16 + 2)
                         );

Inside a function, the array needs to be declared "static" in order to place it in PROGMEM.

  static const PROGMEM uint8_t birdPxf[NUM_FRAMES][8][16][3] = {

Would that explain why it worked without the special access normally required as noted by @kolaha?

I wonder aloud so to speak whether this would have shown up as a compiler warning.

In any case, @jshotts - if you haven't done, go to the IDE preferences and crank up all warnings and verbosity. From time to time these messages, suppressed by default, can provide valuable information about your code.

a7

It does.

If I compile your sketch for a Mega, I get the following warnings/errors


C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202407-8092-1q29c0g.chnt\sketch_jan7a\sketch_jan7a.ino: In function 'void writeBirdFrame(uint8_t)':
C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202407-8092-1q29c0g.chnt\sketch_jan7a\sketch_jan7a.ino:44:57: warning: '__progmem__' attribute ignored [-Wattributes]
   const PROGMEM uint8_t birdPxf[NUM_FRAMES - 1][8][16][3] = {
                                                         ^
C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202407-8092-1q29c0g.chnt\sketch_jan7a\sketch_jan7a.ino:54:3: error: too many initializers for 'const uint8_t [7][8][16][3] {aka const unsigned char [7][8][16][3]}'
   };
   ^
C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202407-8092-1q29c0g.chnt\sketch_jan7a\sketch_jan7a.ino:56:50: warning: '__progmem__' attribute ignored [-Wattributes]
   const PROGMEM uint8_t lastFramebirdPxf[8][16][3] = {{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {255, 255, 255}, {1, 1, 1}, {255, 255, 255}, {255, 255, 255}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0}, {222, 221, 210}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {254, 254, 252}, {222, 221, 210}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {1, 1, 1}, {222, 221, 210}, {222, 221, 210}, {222, 221, 210}, {239, 127, 68}, {222, 221, 210}, {222, 221, 210}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {208, 108, 56}, {208, 108, 56}, {0, 0, 0}, {0, 0, 0}, {239, 127, 68}, {239, 127, 68}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}};
                                                  ^
C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202407-8092-1q29c0g.chnt\sketch_jan7a\sketch_jan7a.ino: In function 'uint16_t XY(uint8_t, uint8_t)':
C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202407-8092-1q29c0g.chnt\sketch_jan7a\sketch_jan7a.ino:84:9: warning: comparison is always true due to limited range of data type [-Wtype-limits]
   if (0 <= x && x <= 31 && 0 <= y && y <= 15)
       ~~^~~~
C:\Users\Wim\AppData\Local\Temp\.arduinoIDE-unsaved202407-8092-1q29c0g.chnt\sketch_jan7a\sketch_jan7a.ino:84:30: warning: comparison is always true due to limited range of data type [-Wtype-limits]
   if (0 <= x && x <= 31 && 0 <= y && y <= 15)
                            ~~^~~~

The first conclusion is that placing PROGMEM variables inside a function is useless; this should be a global variable.

The second one is that your code does not compile :wink: uint8_t birdPxf[NUM_FRAMES - 1]... is 7 elements, you try to initialise with 8.

Note:
If you haven't done so yet, it's advisable to set compiler warnings to 'All' in file → preferences in the IDE.

Rather than storing and retrieving nested arrays of values for each pixel and panel, assign an ASCII character to a color in a flat array for each panel. Let the sketch to the processing from character to color. Here is an example using a 16x32 neopixel panel.

Thanks everyone for your suggestions. I'm going to create a pallate as xfpd suggested. I think I'm going to keep it in a 3D array just because it makes it easier to understand in the arduino code. I didn't know about wokwi.com, that's very cool. I'm just not going to use PROGMEM, it seems more trouble than it's worth.

Here's an updated code snippet

void writeBirdFrame(uint8_t frame){
  FastLED.clear();//clear LED display

  static const long DuckPxC[7] = {0x000000, 0xDEDDD2, 0xFFFFFF, 0xEF7F44, 0x010101, 0xFEFEFC, 0xD06C38};
  static const uint8_t DuckPxf[11][8][16] = {
    {{0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 3, 3, 2, 4, 2, 2, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 5, 0, 1, 2, 2, 2, 2, 6, 1, 0, 0}, {0, 0, 0, 0, 0, 5, 5, 1, 1, 1, 3, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 3, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0}},
    {{0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 3, 3, 2, 4, 5, 2, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 4, 0, 1, 2, 2, 2, 2, 5, 1, 0, 0, 0}, {0, 0, 0, 0, 4, 4, 1, 1, 1, 3, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 6, 0, 0, 3, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 6, 6, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {{0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
    {{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 3, 3, 2, 4, 2, 2, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 4, 0, 1, 2, 2, 2, 2, 5, 1, 0}, {0, 0, 0, 0, 0, 0, 4, 4, 1, 1, 1, 3, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 3, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 3, 3, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
  };

  for (int j = 7; j >= 0; j--){
    for (int i = 0; i <= 15; i++) {
      leds[XY(i+8, 7-j)] =  DuckPxC[DuckPxf[frame][j][i]];
    }
  }

  FastLED.show();
}

Here's the updated python code, it's messing up the color in frames 5-8 for some reason, I'll have to tweak it a bit more:

import cv2
import numpy as np
from PIL import Image, GifImagePlugin

#Source: https://pillow.readthedocs.io/en/stable/handbook/tutorial.html#image-sequences
#https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#reading-sequences

#generally strategy is for each frame of the gif, treat every 20 image pixels as one pixel art px 
#and get the center of the 20 image px to get an acurate color reading

if __name__ == "__main__":

    def main():
        #input manually, only used when printing image
        heightPx = 16
        widthPx = 7
        name = "Duck"
        
        frames = []
        updatedPallete = []
        numFrames = 0 #counted automatically
        
        #needed to get the first frame of the gif
        GifImagePlugin.LOADING_STRATEGY = GifImagePlugin.LoadingStrategy.RGB_ALWAYS
        
        #creates a 4D array of frames: #frames, height(#rows), width(width px), pixels (3 colors)
        with Image.open("Duck2.gif") as im:
            im.seek(0)#go to the first image
            try:
                while(1):
                    #get the data of the image and store it in an array
                    data = np.array(im)
                    data = data.tolist()
                    #convert the large image array into the smaller pixel art array
                    frame, pallete = createPxFrame(data)
                    frames.append(frame)
                    updatedPallete = pallete
                    #simple counter
                    numFrames+=1
                    im.seek(im.tell()+1)#incriment the array
            #flags when all of the frames have been captured
            except EOFError:
                pass  # end of sequence
        
        print(f"static const long {name}PxC[{len(pallete)}] = ", end="")
        myStr = str(updatedPallete)
        myStr = myStr.replace("'",'')
        myStr = myStr.replace("[","{")
        myStr = myStr.replace("]","}")
        print(myStr, end="")
        print(";")
        
        #print out final array
        print(f"static const uint8_t {name}Pxf[{numFrames}][{widthPx}][{heightPx}] = {{")
        
        #need to remove some stuff
        for frame in frames:
            myStr = "   " + str(frame)
            myStr = myStr.replace("[","{")
            myStr = myStr.replace("]","}")
            print(myStr+",")

        print("};")
    
    #convert RGB to hex string
    def rgb_to_hex(r, g, b):
        return '0x{:02X}{:02X}{:02X}'.format(r, g, b)
    
    def createPxFrame(data):
        newData = []
        pallete = []
        
        #Each large pixel is 20 png pixels
        #320 times for outside of loop with 16 height pixel image
        for i in range(len(data)):
            #checks if in center of pixels
            if (i%10 == 0) and (i%20 != 0):
                tempData = []
                #640 times for inside of loop with 32 pixel image
                for j in range(len(data[i])):
                    #checks for center of pixel
                    if (j%10 == 0) and (j%20 != 0):
                        tempData.append(data[i][j])
                        #print(len(tempData))
                #loop through row, converting each pixel to hex
                for i, pixel in enumerate(tempData):
                    color = rgb_to_hex(pixel[0], pixel[1], pixel[2])
                    if color not in pallete:
                        pallete.append(color)
                        tempData[i] = pallete.index(color)
                    else:
                        tempData[i] = pallete.index(color)
                    
                newData.append(tempData)
                #print(len(tempData[:][-1:]))

        return newData, pallete

    main()

Also thanks for the suggestions about turning on warnings, I did that and it's super helpful.

Correct Python Script (nevermind that palette is spelled wrong):

import cv2
import numpy as np
from PIL import Image, GifImagePlugin

#Source: https://pillow.readthedocs.io/en/stable/handbook/tutorial.html#image-sequences
#https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#reading-sequences

#generally strategy is for each frame of the gif, treat every 20 image pixels as one pixel art px 
#and get the center of the 20 image px to get an acurate color reading

if __name__ == "__main__":
    def main():
        numWhite = 0
        #input manually, only used when printing image
        heightPx = 16
        widthPx = 7
        name = "Duck"
        
        frames = []
        updatedPallete = []
        numFrames = 0 #counted automatically
        
        #needed to get the first frame of the gif
        GifImagePlugin.LOADING_STRATEGY = GifImagePlugin.LoadingStrategy.RGB_ALWAYS
        
        #creates a 4D array of frames: #frames, height(#rows), width(width px), pixels (3 colors)
        with Image.open("Duck2.gif") as im:
            im.seek(0)#go to the first image
            try:
                while(1):
                    #get the data of the image and store it in an array
                    data = np.array(im)
                    data = data.tolist()
                    #convert the large image array into the smaller pixel art array
                    frame, updatedPallete, numWhite = createPxFrame(data, numWhite, updatedPallete)
                    frames.append(frame)
                    #simple counter
                    numFrames+=1
                    im.seek(im.tell()+1)#incriment the array
                    if(im.tell()>20):
                        break
            #flags when all of the frames have been captured
            except EOFError:
                pass  # end of sequence
        
        print(f"static const long {name}PxC[{len(updatedPallete)}] = ", end="")
        myStr = str(updatedPallete)
        myStr = myStr.replace("'",'')
        myStr = myStr.replace("[","{")
        myStr = myStr.replace("]","}")
        print(myStr, end="")
        print(";")
        
        #print out final array
        print(f"static const uint8_t {name}Pxf[{numFrames}][{widthPx}][{heightPx}] = {{")
        
        #need to remove some stuff
        for frame in frames:
            myStr = "   " + str(frame)
            myStr = myStr.replace("[","{")
            myStr = myStr.replace("]","}")
            print(myStr+",")

        print("};")
        
        print(numWhite)
    #convert RGB to hex string
    def rgb_to_hex(r, g, b):
        return '0x{:02X}{:02X}{:02X}'.format(r, g, b)
    
    def createPxFrame(data, numWhite, pallete):
        newData = []
        
        #Each large pixel is 20 png pixels
        #320 times for outside of loop with 16 height pixel image
        for i in range(len(data)):
            #checks if in center of pixels
            if (i%10 == 0) and (i%20 != 0):
                tempData = []
                #640 times for inside of loop with 32 pixel image
                for j in range(len(data[i])):
                    #checks for center of pixel
                    if (j%10 == 0) and (j%20 != 0):
                        tempData.append(data[i][j])
                        #print(len(tempData))
                #loop through row, converting each pixel to hex
                for i, pixel in enumerate(tempData):
                    color = rgb_to_hex(pixel[0], pixel[1], pixel[2])
                    if color not in pallete:
                        pallete.append(color)
                        tempData[i] = pallete.index(color)
                    else:
                        tempData[i] = pallete.index(color)
                        if(color == '0x000000'):
                            numWhite += 1;
                    
                newData.append(tempData)
                #print(len(tempData[:][-1:]))

        return newData, pallete, numWhite

    main()

This is your duck on xfpd... each frame is a flat array of 8x8... the math to get this is only a matter of placing the first pixel, then "row*8+col" for the other pixels.

{
  "-----====-------"
  "----=++++=------"
  "---@@+%&+=------"
  "----=@+++&=-----"
  "----=@@@==------"
  "-----$----------"
  "------$---------"
  "----$$----------"
};
{
  "--====----------"
  "-=++++=---------"
  "@@+%&+=---------"
  "-=++++&=-------%"
  "%===@==--------%"
  "-x--@-----------"
  "x--@@----------x"
  "----------------"
};
{
  "-====-----------"
  "=++++=----------"
  "*+%++=---------*"
  "=++++&=-------$-"
  "===*==--------$$"
  "---%*-----------"
  "--%**%----------"
  "----------------"
};
{
  "====------------"
  "++++=----------="
  "+%&+=---------@@"
  "++++&=-------%-="
  "==@==--------%%="
  "--@------------$"
  "-@@----------$$-"
  "----------------"
};
{
  "===------------="
  "+++=----------=+"
  "%++=---------@@+"
  "+++&=---------=+"
  "=@==----------=="
  "-@-------------$"
  "@-------------$@"
  "----------------"
};
{
  "==------------=="
  "##=----------=##"
  "##=---------@@#%"
  "##&=---------=@#"
  "@==----------=@@"
  "--------------$-"
  "---------------$"
  "-------------$$-"
};
{
  "=------------==="
  "#=----------=###"
  "#=---------@@#%#"
  "#&=---------=@##"
  "==----------=@@@"
  "-------------$--"
  "--------------$-"
  "----------%-$$--"
};
{
  "------------===="
  "=----------=++++"
  "=---------@@+%&+"
  "&=---------=++++"
  "=----------===@="
  "------------$-@-"
  "-----------$@@--"
  "----------------"
};
{
  "---------====---"
  "--------=####=--"
  "-------@@#%##=--"
  "------%-=####&=-"
  "------%%===@==--"
  "--------$--@----"
  "------$$--@@----"
  "----------------"
};

Your expanded version has...
{0,0,0} - 823 (color - count)
{222, 221, 210} - 120
{255, 254, 254} - 61
{239, 127, 68} - 48
{208, 108, 56} - 25
{1, 1, 1} - 22
{254, 254, 252} - 13
{255, 255, 255} - 31
{239, 126, 67} - 6
{209, 108, 56} - 3

Last Update: I took a second look and Decided PROGMEM really was necessary. I made a better solution using pgm_read_byte_near().

Improved Arduino Code:

#include <FastLED.h>
#include <avr/pgmspace.h>

#define LED_PIN     3
#define NUM_LEDS    512
#define NUM_FRAMES  2


CRGBArray<NUM_LEDS> leds;


const long pandaPxC[] = {0x62B6FA, 0x77AC6C, 0x4B7B41, 0x010101, 0x2F2F2F, 0xFFFFFF, 0xFEB3B3, 0x7D7B7B, 0x202020, 0xACACAC, 0x63B7FA, 0xFEB4B4, 0x7D7C7C, 0xABACAC};
const PROGMEM uint8_t pandaPxF[] = {0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 2, 3, 3, 1, 0, 0, 2, 2, 0, 3, 3, 1, 0, 1, 0, 0, 3, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 3, 0, 1, 0, 3, 4, 4, 3, 4, 5, 5, 5, 5, 4, 3, 4, 4, 3, 1, 0, 3, 4, 3, 5, 5, 5, 5, 5, 5, 5, 5, 3, 4, 3, 1, 0, 3, 4, 5, 5, 4, 4, 5, 5, 4, 4, 5, 5, 4, 3, 1, 1, 1, 3, 5, 4, 3, 3, 5, 5, 3, 3, 4, 5, 3, 2, 2, 1, 1, 3, 5, 4, 4, 5, 5, 5, 5, 4, 4, 5, 3, 2, 2, 1, 1, 3, 5, 5, 5, 5, 3, 3, 5, 5, 5, 5, 3, 2, 2, 1, 1, 3, 5, 6, 6, 5, 5, 5, 5, 6, 6, 5, 3, 2, 2, 1, 1, 2, 3, 5, 5, 5, 7, 7, 5, 5, 5, 3, 1, 1, 2, 1, 1, 2, 3, 8, 9, 9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ED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(100); //helps to limit the current draw to a safe amount if too many LEDs are lit

  FastLED.clear();
  FastLED.show();

  delay(1000);
}

void loop() {
  pandaAnim();
}

void pandaAnim(){
  FastLED.clear();//clear LED display

  static uint8_t frame = 0;

  for(int j = 0; j<= 15; j++){
    for (int i = 0; i <= 15; i++){
      leds[XY(i+8, 15-j)] =  pandaPxC[pgm_read_byte_near(pandaPxF + j*16 + i+frame*16*16)];
    }
  }

  frame+=1;
  if(frame>=2) frame = 0;
  delay(400);

  FastLED.show();
}



//transformation that returns an index (for FastLED) with input coordinates
uint16_t XY(uint8_t x, uint8_t y)
{
  //checks for input range to make everything safe, don't need to check for zero bc overflow
  if(x<=31 && y<=15){
    uint16_t i;
    //check for first or second matrix 
      //&0x01 checks if odd
    bool addAtEnd = false;
    if (x>15){
      x -= 16;
      addAtEnd = true;
    }
      if(y & 0x01){
        // Even rows run backwards
        uint8_t reverseX = 15 - x;
        uint8_t reverseY = 15 - y;
        i = (reverseY * 16) + reverseX;
      } 
      else {
          // odd rows run forwards
        uint8_t reverseY = 15 - y;
        i = (reverseY * 16) + x;
      }
      if(addAtEnd){
        i+=256;
      }
      /*
      Serial.print("x: ");
      Serial.print(x);
      Serial.print(" y: ");
      Serial.print(y);
      Serial.print(" i: ");
      Serial.println(i);*/
      return i;
  }
  else{
    //Serial.println(" bad val");
    return NUM_LEDS;
  }
}

Improved Python Code:

import cv2
import numpy as np
from PIL import Image, GifImagePlugin

#Source: https://pillow.readthedocs.io/en/stable/handbook/tutorial.html#image-sequences
#https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#reading-sequences

#generally strategy is for each frame of the gif, treat every 20 image pixels as one pixel art px 
#and get the center of the 20 image px to get an acurate color reading

if __name__ == "__main__":
    def main():
        numWhite = 0
        #input manually, only used when printing image
        heightPx = 16
        widthPx = 16
        name = "Duck"
        
        frames = []
        updatedPallete = []
        numFrames = 0 #counted automatically
        
        #needed to get the first frame of the gif
        GifImagePlugin.LOADING_STRATEGY = GifImagePlugin.LoadingStrategy.RGB_ALWAYS
        
        #creates a 4D array of frames: #frames, height(#rows), width(width px), pixels (3 colors)
        with Image.open("Panda.gif") as im:
            im.seek(0)#go to the first image
            try:
                while(1):
                    #get the data of the image and store it in an array
                    data = np.array(im)
                    data = data.tolist()
                    #convert the large image array into the smaller pixel art array
                    frame, updatedPallete, numWhite = createPxFrame(data, numWhite, updatedPallete)
                    frames.append(frame)
                    #simple counter
                    numFrames+=1
                    im.seek(im.tell()+1)#incriment the array
            #flags when all of the frames have been captured
            except EOFError:
                pass  # end of sequence
        
        print(f"const long {name}PxC[{len(updatedPallete)}] = ", end="")
        myStr = str(updatedPallete)
        myStr = myStr.replace("'",'')
        myStr = myStr.replace("[","{")
        myStr = myStr.replace("]","}")
        print(myStr, end="")
        print(";")
        
        #print array of dimensions
        print(f"const uint8_t {name}PxD[] = {{{numFrames}, {widthPx}, {heightPx}}}")
        
        #collapse array
        pixels = []
        for frame in frames:
            for row in frame:
                for px in row:
                    pixels.append(px)
        
        #print out pixels array
        print(f"const PROGMEM uint8_t {name}PxF[{len(pixels)}] = {{")
        
        #delete "["
        myStr = str(pixels)
        myStr = myStr.replace("[","")
        myStr = myStr.replace("]","")
        
        print(myStr);
        print("};")
        
        print(numWhite)
    #convert RGB to hex string
    def rgb_to_hex(r, g, b):
        return '0x{:02X}{:02X}{:02X}'.format(r, g, b)
    
    def createPxFrame(data, numWhite, pallete):
        newData = []
        
        #Each large pixel is 20 png pixels
        #320 times for outside of loop with 16 height pixel image
        for i in range(len(data)):
            #checks if in center of pixels
            if (i%10 == 0) and (i%20 != 0):
                tempData = []
                #640 times for inside of loop with 32 pixel image
                for j in range(len(data[i])):
                    #checks for center of pixel
                    if (j%10 == 0) and (j%20 != 0):
                        tempData.append(data[i][j])
                        #print(len(tempData))
                #loop through row, converting each pixel to hex
                for i, pixel in enumerate(tempData):
                    color = rgb_to_hex(pixel[0], pixel[1], pixel[2])
                    if color not in pallete:
                        pallete.append(color)
                        tempData[i] = pallete.index(color)
                    else:
                        tempData[i] = pallete.index(color)
                        if(color == '0x000000'):
                            numWhite += 1;
                    
                newData.append(tempData)
                #print(len(tempData[:][-1:]))

        return newData, pallete, numWhite

    main()

I used this in another 16x32 ws2812 project, then saw pgm_read_byte();... did you choose your function over this function for a reason?

Curious I google

https://www.avrfreaks.net/s/topic/a5C3l000000UYnXEAW/t147557

a7

The basically is no difference between pgm_read_byte() and pgm_read_byte_near(), it only gets important when you need pgm_read_byte_far().

1 Like

I did not really think about it too hard, pgm_read_byte_near() was just the first one I saw.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.