I am try to use my own palate: DEFINE_GRADIENT_PALETTE( heatmap_gp ) { 0, 0,

I am try to use my own palate:

DEFINE_GRADIENT_PALETTE( heatmap_gp ) {
0, 0, 0, 0, //black
128, 255, 0, 0, //red
224, 255, 255, 0, //bright yellow
255, 255, 255, 255 //full white
};
CRGBPalette16 myPal = heatmap_gp;

But when I compile, I get the following:

Warning: Board breadboard:avr:atmega328bb doesn’t define a ‘build.board’ preference. Auto-set to: AVR_ATMEGA328BB
WARNING: Spurious .github folder in ‘Adafruit DotStar’ library
In file included from /Users/fed/Documents/Arduino/LED_strip_45/LED_strip_45.ino:30:0:
/Users/fed/Documents/Arduino/libraries/FastLED-3.1.6/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.006

pragma message “FastLED version 3.001.006”

                ^

In file included from /Users/fed/Library/Arduino15/packages/arduino/hardware/avr/1.6.19/cores/arduino/Arduino.h:28:0,
from sketch/LED_strip_45.ino.cpp:1:
/Users/fed/Documents/Arduino/LED_strip_45/LED_strip_45.ino: In function ‘void fire()’:
/Users/fed/Documents/Arduino/libraries/FastLED-3.1.6/fastled_progmem.h:33:35: error: ‘heatmap_gp’ has both ‘extern’ and initializer
#define FL_PROGMEM PROGMEM
^
/Users/fed/Documents/Arduino/libraries/FastLED-3.1.6/colorutils.h:1672:52: note: in expansion of macro ‘FL_PROGMEM’
extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM =
^
/Users/fed/Documents/Arduino/LED_strip_45/LED_strip_45.ino:455:3: note: in expansion of macro ‘DEFINE_GRADIENT_PALETTE’
DEFINE_GRADIENT_PALETTE( heatmap_gp ) {
^
LED_strip_45:461: error: ‘heatmap_gp’ was not declared in this scope
CRGBPalette16 myPal = heatmap_gp;
^
exit status 1
‘heatmap_gp’ was not declared in this scope

Any idea what I am doing wrong?

Close the Arduino IDE. Then rename your FastLED library folder from:
FastLED-3.1.6
to just:
FastLED

Restart Arduino and see if that fixes it.

I just tried it. Similar issue. Thanks anyhow. Any further suggestions?

Warning: Board breadboard:avr:atmega328bb doesn’t define a ‘build.board’ preference. Auto-set to: AVR_ATMEGA328BB
In file included from /Users/fed/Documents/Arduino/LED_strip_47/LED_strip_47.ino:30:0:
/Users/fed/Documents/Arduino/libraries/FastLED/FastLED.h:17:21: note: #pragma message: FastLED version 3.001.006

pragma message “FastLED version 3.001.006”

                ^

In file included from /Users/fed/Library/Arduino15/packages/arduino/hardware/avr/1.6.19/cores/arduino/Arduino.h:28:0,
from sketch/LED_strip_47.ino.cpp:1:
/Users/fed/Documents/Arduino/LED_strip_47/LED_strip_47.ino: In function ‘void fire()’:
/Users/fed/Documents/Arduino/libraries/FastLED/fastled_progmem.h:33:35: error: ‘heatmap_gp’ has both ‘extern’ and initializer
#define FL_PROGMEM PROGMEM
^
/Users/fed/Documents/Arduino/libraries/FastLED/colorutils.h:1672:52: note: in expansion of macro ‘FL_PROGMEM’
extern const TProgmemRGBGradientPalette_byte X[] FL_PROGMEM =
^
/Users/fed/Documents/Arduino/LED_strip_47/LED_strip_47.ino:456:3: note: in expansion of macro ‘DEFINE_GRADIENT_PALETTE’
DEFINE_GRADIENT_PALETTE( heatmap_gp ) {
^
LED_strip_47:462: error: ‘heatmap_gp’ was not declared in this scope
CRGBPalette16 myPal = heatmap_gp;
^
exit status 1
‘heatmap_gp’ was not declared in this scope

Do you have a short example of how it should be used? Maybe I can try that.

@Fed_Sanchez Put your code on http://gist.github.com and share the link so we can have a look.

I figured it out. A really silly mistake. DEFINE_GRADIENT_PALETTE needs to be ourside the subroutine. Sorry for wasting your communal time.

I did have another question, however. I noticed in Setup(),

delay(3000); // 3 second delay for recovery

Why is this needed?

I believe that’s there to allow you time to upload new code if you’ve done something silly in your program (such as putting your board into such a low power state/sleep mode that it disables USB, not allowing you to upload new code…). There might be other reasons to have it there too.

@Fed_Sanchez , I remembered another reason I often have a delay in my startup. If you do this (without any delay):

void setup() {
Serial.begin(115200); //start serial monitor
//…other setup stuff here…
Serial.print(“Setup complete”); //won’t show up
}

You might not ever see the Serial.print message because even though Serial.begin has been started, the program gets to the print statement so quickly that the serial monitor hasn’t had a chance to actually connect. If you put about a 1500ms delay after Serial.begin it will allow enough time for the serial monitor to start and the print statement will show up. (The length of the delay needed might depend on the speed of the micro controller being used.) Something like this:

void setup() {
Serial.begin(115200);
delay(1500);
//…other setup stuff here…
Serial.print(“Setup complete”); //will show up
}