Fire2012 Error

I am struggling with the Fire2012 sketch. I keep getting this error in the compilation.

Arduino: 1.6.4 (Windows 7), Board: "Arduino Uno"

Fire2012.cpp.o: In function Fire2012()': C:\Program Files\Arduino/Fire2012.ino:95: undefined reference to HeatColor(unsigned char)'
collect2.exe: error: ld returned 1 exit status
Error compiling.

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


Verbose in attachment...

Arduino.pdf (84 KB)

You haven't installed the library.
It would be a lot better if you posted the code you are trying to compile then we could try it. Please use code tags ( that is the </> icon )

#include <FastLED.h>
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
#include <hsv2rgb.h>
#define LED_PIN     6
#define COLOR_ORDER GRB
#define CHIPSET     WS2811
#define NUM_LEDS    36

#define BRIGHTNESS  200
#define FRAMES_PER_SECOND 60

CRGB leds[NUM_LEDS];

void setup() {
  delay(3000); // sanity delay
  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );
}

void loop()
{
  // Add entropy to random number generator; we use a lot of it.
  random16_add_entropy( random());

  Fire2012(); // run simulation frame
  
  FastLED.show(); // display this frame
  FastLED.delay(1000 / FRAMES_PER_SECOND);
}


// Fire2012 by Mark Kriegsman, July 2012
// as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY
//// 
// This basic one-dimensional 'fire' simulation works roughly as follows:
// There's a underlying array of 'heat' cells, that model the temperature
// at each point along the line.  Every cycle through the simulation, 
// four steps are performed:
//  1) All cells cool down a little bit, losing heat to the air
//  2) The heat from each cell drifts 'up' and diffuses a little
//  3) Sometimes randomly new 'sparks' of heat are added at the bottom
//  4) The heat from each cell is rendered as a color into the leds array
//     The heat-to-color mapping uses a black-body radiation approximation.
//
// Temperature is in arbitrary units from 0 (cold black) to 255 (white hot).
//
// This simulation scales it self a bit depending on NUM_LEDS; it should look
// "OK" on anywhere from 20 to 100 LEDs without too much tweaking. 
//
// I recommend running this simulation at anywhere from 30-100 frames per second,
// meaning an interframe delay of about 10-35 milliseconds.
//
// Looks best on a high-density LED setup (60+ pixels/meter).
//
//
// There are two main parameters you can play with to control the look and
// feel of your fire: COOLING (used in step 1 above), and SPARKING (used
// in step 3 above).
//
// COOLING: How much does the air cool as it rises?
// Less cooling = taller flames.  More cooling = shorter flames.
// Default 50, suggested range 20-100 
#define COOLING  55

// SPARKING: What chance (out of 255) is there that a new spark will be lit?
// Higher chance = more roaring fire.  Lower chance = more flickery fire.
// Default 120, suggested range 50-200.
#define SPARKING 120


void Fire2012()
{
// Array of temperature readings at each simulation cell
  static byte heat[NUM_LEDS];

  // Step 1.  Cool down every cell a little
    for( int i = 0; i < NUM_LEDS; i++) {
      heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
    }
  
    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
    for( int k= NUM_LEDS - 1; k >= 2; k--) {
      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
    }
    
    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
    if( random8() < SPARKING ) {
      int y = random8(7);
      heat[y] = qadd8( heat[y], random8(160,255) );
    }

    // Step 4.  Map from heat cells to LED colors
    for( int j = 0; j < NUM_LEDS; j++) {
        leds[j] = HeatColor( heat[j] );
    }
}

Well that compiles for me. Have you installed all the libraries correctly?

I have checked the libraries and it is installed. I am still getting one error as follows:


Arduino: 1.6.4 (Windows 7), Board: "Arduino Uno"

Using library FastLED-3.0.3 in folder: C:\Users\Gary\Documents\Arduino\libraries\FastLED-3.0.3 (legacy)

Using library Adafruit NeoPixel in folder: C:\Users\Gary\Documents\Arduino\libraries\Adafruit_NeoPixel-master

C:\Users\Gary\AppData\Local\Temp\build8345576961688542093.tmp\sketch_jun04a.cpp.o: In function Fire2012()': C:\Program Files\Arduino/sketch_jun04a.ino:98: undefined reference to HeatColor(unsigned char)'
collect2.exe: error: ld returned 1 exit status
Error compiling.


Seems that I am missing a definition reference to HeatColor. Here is the code I have now.

#include <FastLED.h>
#include <Adafruit_NeoPixel.h>
#include <avr/power.h>
#define LED_PIN    6
#define DATA_PIN    6
#define COLOR_ORDER GRB
#define CHIPSET     WS2811
#define NUM_LEDS    36
#define CLOCK_PIN 13

#define BRIGHTNESS  200
#define FRAMES_PER_SECOND 60

Adafruit_NeoPixel strip = Adafruit_NeoPixel(36, DATA_PIN, NEO_GRB + NEO_KHZ800);

CRGB leds[NUM_LEDS];

void setup() {
  delay(3000); // sanity delay
  FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness( BRIGHTNESS );
}

void loop()
{
  // Add entropy to random number generator; we use a lot of it.
  random16_add_entropy( random());

  Fire2012(); // run simulation frame
  
  FastLED.show(); // display this frame
  FastLED.delay(1000 / FRAMES_PER_SECOND);
}


// Fire2012 by Mark Kriegsman, July 2012
// as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY
//// 
// This basic one-dimensional 'fire' simulation works roughly as follows:
// There's a underlying array of 'heat' cells, that model the temperature
// at each point along the line.  Every cycle through the simulation, 
// four steps are performed:
//  1) All cells cool down a little bit, losing heat to the air
//  2) The heat from each cell drifts 'up' and diffuses a little
//  3) Sometimes randomly new 'sparks' of heat are added at the bottom
//  4) The heat from each cell is rendered as a color into the leds array
//     The heat-to-color mapping uses a black-body radiation approximation.
//
// Temperature is in arbitrary units from 0 (cold black) to 255 (white hot).
//
// This simulation scales it self a bit depending on NUM_LEDS; it should look
// "OK" on anywhere from 20 to 100 LEDs without too much tweaking. 
//
// I recommend running this simulation at anywhere from 30-100 frames per second,
// meaning an interframe delay of about 10-35 milliseconds.
//
// Looks best on a high-density LED setup (60+ pixels/meter).
//
//
// There are two main parameters you can play with to control the look and
// feel of your fire: COOLING (used in step 1 above), and SPARKING (used
// in step 3 above).
//
// COOLING: How much does the air cool as it rises?
// Less cooling = taller flames.  More cooling = shorter flames.
// Default 50, suggested range 20-100 
#define COOLING  55

// SPARKING: What chance (out of 255) is there that a new spark will be lit?
// Higher chance = more roaring fire.  Lower chance = more flickery fire.
// Default 120, suggested range 50-200.
#define SPARKING 120


void Fire2012()
{
// Array of temperature readings at each simulation cell
  static byte heat[NUM_LEDS];

  // Step 1.  Cool down every cell a little
    for( int i = 0; i < NUM_LEDS; i++) {
      heat[i] = qsub8( heat[i],  random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
    }
  
    // Step 2.  Heat from each cell drifts 'up' and diffuses a little
    for( int k= NUM_LEDS - 1; k >= 2; k--) {
      heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
    }
    
    // Step 3.  Randomly ignite new 'sparks' of heat near the bottom
    if( random8() < SPARKING ) {
      int y = random8(7);
      heat[y] = qadd8( heat[y], random8(160,255) );
    }

    // Step 4.  Map from heat cells to LED colors
    for( int j = 0; j < NUM_LEDS; j++) {
        leds[j] = HeatColor( heat[j]);
    }
}

Here is the code I have now.

And it still compiles. See attached screen shot.

So the code is fine.

What is not fine is the libraries.

Using library Adafruit NeoPixel in folder: C:\Users\Gary\Documents\Arduino\libraries\Adafruit_NeoPixel-master

Is wrong. You should have renamed that folder to just say:-
Adafruit_NeoPixel

That is you should remove the -master from the folder name.

Grumpy_Mike:
And it still compiles. See attached screen shot.

So the code is fine.

What is not fine is the libraries.

Is wrong. You should have renamed that folder to just say:-
Adafruit_NeoPixel

That is you should remove the -master from the folder name.

That makes sense to me but it still is giving me the same error after renaming the folder. I am not sure just what I did wrong. Here is error reported:
Arduino: 1.6.4 (Windows 7), Board: "Arduino Uno"

Build options changed, rebuilding all

Using library FastLED-3.0.3 in folder: C:\Users\Gary\Documents\Arduino\libraries\FastLED-3.0.3 (legacy)

Using library Adafruit NeoPixel in folder: C:\Users\Gary\Documents\Arduino\libraries\Adafruit_NeoPixel

C:\Program Files\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files\Arduino\hardware\arduino\avr\variants\standard -IC:\Users\Gary\Documents\Arduino\libraries\FastLED-3.0.3 -IC:\Users\Gary\Documents\Arduino\libraries\Adafruit_NeoPixel C:\Users\Gary\AppData\Local\Temp\build7265112532029152507.tmp\Fire2015.cpp -o C:\Users\Gary\AppData\Local\Temp\build7265112532029152507.tmp\Fire2015.cpp.o

//skipped the middle because it was over the message limit.

C:\Users\Gary\AppData\Local\Temp\build7265112532029152507.tmp\Fire2015.cpp.o: In function Fire2012()': C:\Program Files\Arduino/Fire2015.ino:98: undefined reference to HeatColor(unsigned char)'
collect2.exe: error: ld returned 1 exit status
Error compiling.

I do not understand what this error is trying to tell me? As you can see I did rename the library folder but still received the same error. Could it be that the Arduino Uno cannot do it?

The function HeatColor is defined in the colorutils.cpp file in the Fast LED library.

It looks like this library is either old or miss installed.

Using library FastLED-3.0.3 in folder: C:\Users\Gary\Documents\Arduino\libraries\FastLED-3.0.3 (legacy)

The folder should be called just FastLED and not "FastLED-3.0.3 (legacy)".

Mike...I found the problem. Several lines of code were missing. The directory name made no difference as Arduino IDE finds the libraries upon reboot. Now what I am trying to figure out is how to make the strip begin from the other end so that I do not have to rework my assembly. Do you have any ideas?

It makes things easier to grab always the latest FastLED branch which is 3.1 at the moment. Many compiler issues are caused by uncompatible Arduio IDE and FastLED versions.

Reversing the fire effect: Why not just copy the leds array into an other one while reversing the sequence?