I'm a beginner so please forgive my ignorance. I am trying to modify the fastled fire code to work on 5 strips of 12 LEDs that I have soldered together (see attached image). The original code works fine, but I do not want it to function as one strip, I want each strip to get the fire animation. I was inspired by this post; I do not have the android app, so I tried to use his example of defining both NUM_LEDS and NUM_STRIPS and changing the code throughout. I can't get it to work, and I get a lot of error messages (see below the code). I feel pretty dumb right now. Can anyone help me?
#include <FastLED.h>
#define LED_PIN 1
#define COLOR_ORDER GRB
#define CHIPSET WS2812
#define NUM_LEDS 12
#define NUM_STRIPS 5
#define BRIGHTNESS 150
#define FRAMES_PER_SECOND 20
CRGB leds[NUM_STRIPS * NUM_LEDS];
CRGBPalette16 gPal;
void setup() {
delay(3000); // sanity delay
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_STRIPS * NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS );
gPal = CRGBPalette16( CRGB::Black, CRGB::Red, CRGB::Yellow, CRGB::White);
}
void loop()
{
Fire2012WithPalette();
FastLED.show();
FastLED.delay(1000 / FRAMES_PER_SECOND);
}
// COOLING: How much does the air cool as it rises?
// Less cooling = taller flames. More cooling = shorter flames.
// Default 55, 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 50
void Fire2012WithPalette(int stripNo) {
// Array of temperature readings at each simulation cell
static byte heat[NUM_STRIPS][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 - 3; k > 0; 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++) {
// Scale the heat value from 0-255 down to 0-240
// for best results with color palettes.
byte colorindex = scale8( heat[j], 240);
leds[j] = ColorFromPalette( gPal, colorindex);
}
}
ERROR MESSAGES
/Users/marycollins/Documents/Arduino/fire_3/fire_3.ino: In function 'void loop()':
fire_3:79:23: error: too few arguments to function 'void Fire2012WithPalette(int)'
Fire2012WithPalette(); // run simulation frame, using palette colors
^
/Users/marycollins/Documents/Arduino/fire_3/fire_3.ino:123:6: note: declared here
void Fire2012WithPalette(int stripNo) {
^
/Users/marycollins/Documents/Arduino/fire_3/fire_3.ino: In function 'void Fire2012WithPalette(int)':
fire_3:129:28: error: invalid conversion from 'byte* {aka unsigned char*}' to 'uint8_t {aka unsigned char}' [-fpermissive]
heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
^
In file included from /Users/marycollins/Documents/Arduino/libraries/FastLED/lib8tion.h:385:0,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/pixeltypes.h:7,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/controller.h:9,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/FastLED.h:47,
from /Users/marycollins/Documents/Arduino/fire_3/fire_3.ino:1:
/Users/marycollins/Documents/Arduino/libraries/FastLED/lib8tion/math8.h:88:34: error: initializing argument 1 of 'uint8_t qsub8(uint8_t, uint8_t)' [-fpermissive]
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8( uint8_t i, uint8_t j)
^
fire_3:129:13: error: incompatible types in assignment of 'uint8_t {aka unsigned char}' to 'byte [12] {aka unsigned char [12]}'
heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / NUM_LEDS) + 2));
^
fire_3:134:40: error: invalid operands of types 'byte [12] {aka unsigned char [12]}' and 'byte [12] {aka unsigned char [12]}' to binary 'operator+'
heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
^
fire_3:140:28: error: invalid conversion from 'byte* {aka unsigned char*}' to 'uint8_t {aka unsigned char}' [-fpermissive]
heat[y] = qadd8( heat[y], random8(160,255) );
^
In file included from /Users/marycollins/Documents/Arduino/libraries/FastLED/lib8tion.h:385:0,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/pixeltypes.h:7,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/controller.h:9,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/FastLED.h:47,
from /Users/marycollins/Documents/Arduino/fire_3/fire_3.ino:1:
/Users/marycollins/Documents/Arduino/libraries/FastLED/lib8tion/math8.h:23:34: error: initializing argument 1 of 'uint8_t qadd8(uint8_t, uint8_t)' [-fpermissive]
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8( uint8_t i, uint8_t j)
^
fire_3:140:13: error: incompatible types in assignment of 'uint8_t {aka unsigned char}' to 'byte [12] {aka unsigned char [12]}'
heat[y] = qadd8( heat[y], random8(160,255) );
^
fire_3:147:37: error: invalid conversion from 'byte* {aka unsigned char*}' to 'uint8_t {aka unsigned char}' [-fpermissive]
byte colorindex = scale8( heat[j], 240);
^
In file included from /Users/marycollins/Documents/Arduino/libraries/FastLED/lib8tion/math8.h:4:0,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/lib8tion.h:385,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/pixeltypes.h:7,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/controller.h:9,
from /Users/marycollins/Documents/Arduino/libraries/FastLED/FastLED.h:47,
from /Users/marycollins/Documents/Arduino/fire_3/fire_3.ino:1:
/Users/marycollins/Documents/Arduino/libraries/FastLED/lib8tion/scale8.h:20:34: error: initializing argument 1 of 'uint8_t scale8(uint8_t, fract8)' [-fpermissive]
LIB8STATIC_ALWAYS_INLINE uint8_t scale8( uint8_t i, fract8 scale)
^
Multiple libraries were found for "FastLED.h"
Used: /Users/marycollins/Documents/Arduino/libraries/FastLED
exit status 1
too few arguments to function 'void Fire2012WithPalette(int)'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.