256 RGB Matrix with fastled

I figured something was odd when you used the pin 'D2' instead of '2'. For a D1 you probably don't need PROGMEM at all since program memory and RAM are in the same address space.

/* Arduino 256 RGB LEDs Matrix Animation Frame
   Using WS2812 LED Strips

  Created by Barre
*/

#include "FastLED.h"       // Fastled library to control the LEDs
#include "xmas.h"

// How many leds are connected?
#define NUM_LEDS 256

// Define the Data Pin
const byte DATA_PIN = RX;  // Connected to the data pin of the first LED strip

// Define the transistor pin
const byte R_PIN = D2;

// Define the array of leds
CRGB leds[NUM_LEDS];

const long int * Xitems[77] =
{
  Xmas001, Xmas002, Xmas003, 
  Xmas004, Xmas005, Xmas006, 
  Xmas007, Xmas008, Xmas009, 
  Xmas010, Xmas011, Xmas012, 
  Xmas013, Xmas014, Xmas015, 
  Xmas016, Xmas017, Xmas018, 
  Xmas019, Xmas020, Xmas021, 
  Xmas022, Xmas023, Xmas024, 
  Xmas025, Xmas026, Xmas027, 
  Xmas028, Xmas029, Xmas030, 
  Xmas031, Xmas032, Xmas033, 
  Xmas034, Xmas035, Xmas036, 
  Xmas037, Xmas038, Xmas039, 
  Xmas040, Xmas041, Xmas042, 
  Xmas043, Xmas044, Xmas045, 
  Xmas046, Xmas047, Xmas048, 
  Xmas049, Xmas050, Xmas051, 
  Xmas052, Xmas053, Xmas054, 
  Xmas055, Xmas056, Xmas057, 
  Xmas058, Xmas059, Xmas060, 
  Xmas061, Xmas062, Xmas063, 
  Xmas064, Xmas065, Xmas066, 
  Xmas067, Xmas068, Xmas069, 
  Xmas070, Xmas071, Xmas072, 
  Xmas073, Xmas074, Xmas075, 
  Xmas076, Xmas077
};

void setup()
{
  pinMode(R_PIN, OUTPUT);
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // Init of the Fastled library
  FastLED.setBrightness(50);
  FastLED.clear();
}

void loop()
{
  //digitalWrite(R_PIN, HIGH); // turn transistor ON

  // LEDMATRIX();
  RUNMATRIX();
}

void RUNMATRIX()
{
  // Frame 1-77
  FastLED.clear();

  for (byte frame = 0; frame < sizeof(Xitems) / sizeof(Xitems[0]); frame++)
  {
    const long int * ptr = Xitems[frame];
    
    for (long i = 0; i < NUM_LEDS; i++)
    {
      // Each pixel is a 'long' (a.k.a. 'dword')
      leds[i] = ptr[i];
    }
    
    FastLED.show();
    delay(400);
  }
}
1 Like