FastLED WS2812 Project Help needed!

Hi everyone!
I am new in this forum and English is not my native language, so I am sorry for all spell checks.

So I am doing project with 3 WS2812 ledstrips. 1 of those strips should have one effect and 2 other should have same effect. My problem is that controller. Mixes up with eachother.

I am using FastLED framework from here: https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#FastLEDFramework

And 1st strip should have "SnowSparkle" effect and 2 others should have "Fire" effect.
First strip is attached to pin 1 and second to pin2 and 3rd to pin 3.
I have tried that controller thingy already with no success...
I tried so many ways to do this, and then I find this forum! Thanks already if someone is interested to help me out here :slight_smile:

Apin

Maybe take a look at the FastLED guide for handling multiple strips:

I have tried that controller thingy already with no success...

"Controller thingy"? Didn't your parents teach you not to play with your thingy in public?

You have some code that you failed to post that does something that you failed to describe. Clearly, you expect that code to do something other than what it does, but what that is is a mystery.

Try again.

Hi!
Here is a code I am using right now
Can anyone see already whats wrong with it?

#include "FastLED.h"
#define NUM_LEDS 14
#define NUM_STRIPS 3

CRGB leds[NUM_LEDS];
CLEDController *controllers[NUM_STRIPS];
uint8_t gBrightness = 128;

void setup()
{
 
 controllers[0] = &FastLED.addLeds<WS2812,1>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
 controllers[1] = &FastLED.addLeds<WS2812,2>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
 controllers[2] = &FastLED.addLeds<WS2812,3>(leds, NUM_LEDS) .setCorrection( TypicalLEDStrip );
}

// *** REPLACE FROM HERE ***
// Start of SnowSparkle
void loop() {
  SnowSparkle(0x00, 0xff, 0x00, 20, random(100,1000));
  Fire(55,120,15);
}

void SnowSparkle(byte red, byte green, byte blue, int SparkleDelay, int SpeedDelay) {
  setAll(red,green,blue);
  
  int Pixel = random(NUM_LEDS);
  setPixel(Pixel,0xff,0xff,0xff);
  controllers[0]->showLeds(gBrightness);
  delay(50);
  setPixel(Pixel,red,green,blue);
  controllers[0]->showLeds(gBrightness);
  delay(200);
}
// End of SnowSparkle

// Start of Fire
void Fire(int Cooling, int Sparking, int SpeedDelay) {
  static byte heat[NUM_LEDS];
  int cooldown;
  
  // Step 1.  Cool down every cell a little
  for( int i = 0; i < NUM_LEDS; i++) {
    cooldown = random(0, ((Cooling * 10) / NUM_LEDS) + 2);
    
    if(cooldown>heat[i]) {
      heat[i]=0;
    } else {
      heat[i]=heat[i]-cooldown;
    }
  }
  
  // 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' near the bottom
  if( random(255) < Sparking ) {
    int y = random(7);
    heat[y] = heat[y] + random(160,255);
    //heat[y] = random(160,255);
  }

  // Step 4.  Convert heat to LED colors
  for( int j = 0; j < NUM_LEDS; j++) {
    setPixelHeatColor(j, heat[j] );
  }

  controllers[1]->showLeds(gBrightness);
  controllers[2]->showLeds(gBrightness);
  delay(SpeedDelay);
}

void setPixelHeatColor (int Pixel, byte temperature) {
  // Scale 'heat' down from 0-255 to 0-191
  byte t192 = round((temperature/255.0)*191);
 
  // calculate ramp up from
  byte heatramp = t192 & 0x3F; // 0..63
  heatramp <<= 2; // scale up to 0..252
 
  // figure out which third of the spectrum we're in:
  if( t192 > 0x80) {                     // hottest
    setPixel(Pixel, 255, 255, heatramp);
  } else if( t192 > 0x40 ) {             // middle
    setPixel(Pixel, 255, heatramp, 0);
  } else {                               // coolest
    setPixel(Pixel, heatramp, 0, 0);
  }
}
// End of Fire

// *** REPLACE TO HERE ***

void showStrip() {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.show();
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   FastLED.show();
 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.setPixelColor(Pixel, strip.Color(red, green, blue));
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H 
   // FastLED
   leds[Pixel].r = red;
   leds[Pixel].g = green;
   leds[Pixel].b = blue;
 #endif
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue); 
  }
  showStrip();
}

Controlling_multiple_strips.ino (3.09 KB)

Apin97:
Can anyone see already whats wrong with it?

First you’re not using CODE TAGS. If you were, your posted code would look like this:

void setup()
{
 controllers[0] = &FastLED.addLeds<WS2812,1>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip );
 controllers[1] = &FastLED.addLeds<WS2812,1>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip );
 controllers[2] = &FastLED.addLeds<WS2812,1>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip );
}

See how much nicer that is than the mess you posted?

First strip is attached to pin 1 and second to pin2 and 3rd to pin 3.

That’s not what you’re telling the library.

gfvalvo:
That's not what you're telling the library.

How am I going to do that?

Apin97:
How am I going to do that?

You look at the documentation for the library that you are using, and see which value in the constructor call is the pin number that the LEDs are connected to. Then, you use the proper value in the constructor call.

Apin97:
How am I going to do that?

Well, you went back and changed the code you originally posted. So, now my comment does not apply -- assuming Pins 1, 2, 3 on your (unspecified) board are suitable for connection of the WS2812 strips.

If you have a Uno then pin 1 is not suitable as that is used for serial communications.

Yes I got UNO. I have got it now that those pins 3 and 4 is flickering and almost like fire, but leds are green and shows up very slowly

Apin97:
Yes I got UNO. I have got it now that those pins 3 and 4 is flickering and almost like fire, but leds are green and shows up very slowly

Ok so.. That green flame is just wrong RGB calibration, but problem now is only that it is flickering and "moving" slowly

So reduce the delays.