LED Matrix - Error compiling for board Arduino Uno/Genuino

I am new to coding with Arduino, and am trying to lead some Middle Schoolers through building a 16x24 LED Matrix. We are trying to display an image, our mascot, in our LED Matrix. I have tried to combine what I have learned via multiple projects I have studied to make this work, but am now getting an error:

"Error compiling for board Arduino Uno/Genuino"

I have attached the file of my code. Not sure if it's my code, a library or if something needs to be updated. I would appreciate any help I can get. Thanks in advance.

M-code_wildcat-html_picOnly.ino (4.22 KB)

but am now getting an error:

"Error compiling for board Arduino Uno/Genuino"

There's more to it than that.

Please post code, don't attach it.

Please do this:

  • When you encounter an error, you'll see a button on the right side of the orange bar "Copy error messages" in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button..
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum's 9000 character limit, save it to a .txt file and podst it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link.

Okay, here is my code:

//M-code_wildcat-html

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

#define WIDTH 24
#define HEIGHT 16
#define NUM_LEDS WIDTH * HEIGHT

#define DATA_PIN 6
#define SPRITE_WIDTH 16
#define SPRITE_HEIGHT 24


CRGB leds[NUM_LEDS];

void setup() {
  // put your setup code here, to run once:
    FastLED.setBrightness(40);
    FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
}

const long wildcat[16 * 24] PROGMEM = {
        0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000F5,0x0000F5,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000F5,0x0000F5,
        0x000000,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x000000,0x0000F5,0x000000,
        0x000000,0x000000,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0xFFFE04,0x0000F5,0x000000,
        0x000000,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x000000,0x000000,
        0x000000,0x000000,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x000000,
        0x000000,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x000000,
        0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x000000,0x000000,
        0x000000,0x000000,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x000000,
        0x000000,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x000000,0x000000,
        0x000000,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x000000,0x000000,
        0x000000,0x000000,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0x000000,
        0x000000,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x000000,
        0x000000,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x000000,
        0x000000,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x000000,0x000000,
        0x000000,0x000000,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x000000,
        0x000000,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0x000000,0x000000,0x000000,
        0x000000,0x000000,0x000000,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x000000,
        0x000000,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0x000000,0x000000,
        0x000000,0x0000F5,0x000000,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0xFFFE04,0x0000F5,0x000000,
        0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x000000,
        0x000000,0x000000,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0xFFFE04,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,
        0x000000,0x0000F5,0xFFFE04,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0xFFFE04,0x0000F5,0x000000,0x000000,0x000000,
        0x000000,0x000000,0x000000,0x000000,0x0000F5,0xFFFE04,0x0000F5,0x0000F5,0x0000F5,0x000000,0x000000,0x000000,0x0000F5,0x0000F5,0x0000F5,0x000000,
        0x0000F5,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x0000F5,0x0000F5,0x0000F5,0x000000,0x000000,0x000000,0x000000,0x000000};



void loop() {
  
FastLED.clear(); 
    for (int i = 0; i < NUM_LEDS; i++) {
     leds[i] = pgm_read_dword (&(wildcat[i])); 
    }
  }
  
FastLED.show();

}

Here is the error received:

Arduino: 1.8.7 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\kshutt\Desktop\M-code_wildcat-html_picOnly\M-code_wildcat-html_picOnly.ino:4:0:

C:\Users\kshutt\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.005

 #    pragma message "FastLED version 3.002.005"

                     ^

M-code_wildcat-html_picOnly:59:1: error: 'FastLED' does not name a type

 FastLED.show();

 ^

M-code_wildcat-html_picOnly:61:1: error: expected declaration before '}' token

 }

 ^

exit status 1
'FastLED' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

It's interesting that a new error is showing up now. Any help would be great! I have also tried this a different way, and would love to post that code as well if that would be okay.

Looking for some help with a school project. I am new at using Arduino and Fast.Led. Trying to create a picture to show in WS2811 lights. Code compiles correctly, but shows the following comment with "low memory available":

In file included from C:\Users\kshutt\Documents\Arduino\wildcat_led_panel-PROGMEM\wildcat_led_panel-PROGMEM.ino:3:0:

C:\Users\kshutt\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.005

 #    pragma message "FastLED version 3.002.005"

                     ^

Sketch uses 4440 bytes (13%) of program storage space. Maximum is 32256 bytes.
Global variables use 1837 bytes (89%) of dynamic memory, leaving 211 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

I am wondering why I do not get any lights to show. Is the problem just that I don't have enough memory available? I am trying to incorporate using PROGMEM, but not sure how to call my array from PROGMEM. Can someone help me? Here is the code I am currently working with:

//wildcat_led_panel

#include <FastLED.h>    //FastLed library to control the Leds
#include<avr/pgmspace.h> //Store in Flash using PROGMEM
#define NUM_LEDS 384    //How many leds are connected?
#define DATA_PIN 6    //Define the Data Pin on the Arduino that is connected to first led
CRGB leds[NUM_LEDS];    //Define the array of leds

void setup() {
  // put your setup code here, to run once:
  delay(2000);
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  FastLED.setBrightness(40);  //Number  0-255
  FastLED.clear();
}

void loop() {
  // put your main code here, to run repeatedly:

//outline
int blue_outline[] PROGMEM= {5, 7, 14, 15, 17, 18, 19, 20, 21, 22, 23, 26, 27, 28, 30, 34, 35, 38, 39, 40, 41, 42, 46, 49, 51, 53, 54, 55,
                      56, 57, 58, 61, 66, 69, 71, 73, 74, 75, 76, 77, 78, 81, 82, 83, 86, 88, 89, 91, 92, 93, 94, 96, 97, 98, 99, 101,
                      102, 103, 104, 106, 107, 109, 114, 116, 119, 120, 121, 122, 123, 126, 129, 130, 135, 138, 139, 141, 145, 147,
                      153, 154, 156, 157, 162, 164, 166, 167, 169, 171, 172, 173, 174, 177, 179, 180, 182, 184, 185, 188, 190, 193,
                      195, 198, 199, 201, 203, 204, 206, 209, 211, 216, 217, 219, 221, 226, 227, 229, 230, 236, 238, 241, 244, 245,
                      248, 251, 252, 259, 260, 261, 263, 264, 267, 270, 273, 276, 277, 279, 280, 284, 285, 290, 292, 293, 296, 297,
                      300, 302, 304, 306, 307, 309, 310, 311, 313, 314, 315, 316, 318, 322, 324, 325, 326, 327, 329, 330, 332, 335,
                      337, 340, 341, 342, 348, 356, 358, 359, 360, 364, 365, 366, 368, 376, 376, 377, 378};

int gold_fill[] PROGMEM = {24, 25, 36, 37, 43, 44, 45, 50, 52, 59, 60, 67, 68, 70, 72, 84, 85, 87, 90, 100, 105, 108, 115, 117, 118, 124, 125,
                    131, 132, 133, 134, 136, 137, 140, 146, 148, 149, 150, 151, 152, 155, 163, 165, 168, 170, 178, 181, 183, 186, 187,
                    189, 194, 196, 197, 200, 202, 205, 210, 212, 213, 214, 215, 218, 220, 228, 231, 232, 233, 234, 235, 237, 242, 243,
                    246, 247, 249, 250, 262, 265, 266, 268, 269, 274, 275, 278, 281, 282, 283, 291, 294, 295, 298, 299, 301, 305, 308,
                    312, 317, 323, 328, 331, 333, 334, 338, 339, 343, 344, 345, 346, 347, 357};

int show_wildcat_seconds = 60;

int delay_wildcat_seconds = 5;
    for (int i = 0; i < NUM_LEDS; i++){
             leds[i] = CRGB::Black;
     }
  
     for (int i = 0; i < blue_outline; i++) {

      //make blue_outline
              leds[blue_outline[i]] = CRGB::Blue;

            for(int i = 0; i < gold_fill; i++) {
       //fill with gold_fill
              leds[gold_fill[i]] = CRGB::Gold;
      }
}
      FastLED.show();
      
      for (int i = 0; i < delay_wildcat_seconds; i++){
            leds[i] = CRGB::Black;
      }
      FastLED.show();
 }

Remove the spurious "}" before FastLED.show();

Use "Auto-Format" (Ctrl-T) option in order to check such things.

loop() will repeat the command to LEDs ridiculously fast with no useful effect without some other content, but should function as a test.

Take some simple example from FastLED library and make it works with your setup first.

Read this.

I spotted a few things which could be the problem. The guide above says that any variables you want to store in flash must be global or static. So either move your arrays out of loop() or use the static keyword. Also, I don't think you can use int. Try uint16_t instead. Accessing the contents of arrays in flash is not as simple as it is in ram. You have to use special functions like pgm_read_word_near() as described in the guide above.

Thanks for using code tags. Before you post your updated code again, please use Auto-Format. It doesn't change the meaning of the code in any way, but makes it easier for humans to read, and spot mistakes. For example, I think at least one of your } is in the wrong place, because your for-loop for "gold" is actually inside the for-loop for "blue", which I don't think you intended.

This is also wrong:

for (int i = 0; i < blue_outline; i++)

The test "i < blue_outline" will compare i with the memory address of blue_outline, not against the length of the array. To find the length of an array, you can use sizeof(X)/sizeof(X[0]).

This is an issue with the fastLED library (3.3.3), so if you run into this issue before it is fixed just delete the library and revert to version 3.3.2. If you need help deleting a library see this thread: How to Delete a Library from IDE - Programming Questions - Arduino Forum