Adding leds strips

I'm playing around whit adding pin out puts to the colerPatte from FastLED librarie but wen i do i get "LedsB " was not declared in this scope

this part.

void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
    uint8_t brightness = 255;
    
    for( int i = 0; i < NUM_LED1; i++)  {
        ledsA[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
//        LedsB[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);   
        colorIndex += 3;    
   }
 }

ful version

#include <FastLED.h>

#define LED_PINA 3
#define LED_PINB 5
#define NUM_LED1 14
#define NUM_LED2 14
#define BRIGHTNESS  10
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
CRGB ledsA[NUM_LED1];
CRGB ledsB[NUM_LED2];

#define UPDATES_PER_SECOND 100

// This example shows several ways to set up and use 'palettes' of colors
// with FastLED.
//
// These compact palettes provide an easy way to re-colorize your
// animation on the fly, quickly, easily, and with low overhead.
//
// USING palettes is MUCH simpler in practice than in theory, so first just
// run this sketch, and watch the pretty lights as you then read through
// the code.  Although this sketch has eight (or more) different color schemes,
// the entire sketch compiles down to about 6.5K on AVR.
//
// FastLED provides a few pre-configured color palettes, and makes it
// extremely easy to make up your own color schemes with palettes.
//
// Some notes on the more abstract 'theory and practice' of
// FastLED compact palettes are at the bottom of this file.



// This example shows several ways to set up and use 'palettes' of colors
// with FastLED.
//
// These compact palettes provide an easy way to re-colorize your
// animation on the fly, quickly, easily, and with low overhead.
//
// USING palettes is MUCH simpler in practice than in theory, so first just
// run this sketch, and watch the pretty lights as you then read through
// the code.  Although this sketch has eight (or more) different color schemes,
// the entire sketch compiles down to about 6.5K on AVR.
//
// FastLED provides a few pre-configured color palettes, and makes it
// extremely easy to make up your own color schemes with palettes.
//
// Some notes on the more abstract 'theory and practice' of
// FastLED compact palettes are at the bottom of this file.



CRGBPalette16 currentPalette;
TBlendType    currentBlending;

extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;


void setup() {
    delay( 3000 ); // power-up safety delay
    FastLED.addLeds<LED_TYPE, LED_PINA, COLOR_ORDER>(ledsA, NUM_LED1).setCorrection( TypicalLEDStrip );
    FastLED.addLeds<LED_TYPE, LED_PINB, COLOR_ORDER>(ledsB, NUM_LED2).setCorrection( TypicalLEDStrip );
    FastLED.setBrightness(  BRIGHTNESS );
    
    currentPalette = RainbowColors_p;
    currentBlending = LINEARBLEND;
}


void loop()
{
    ChangePalettePeriodically();
    
    static uint8_t startIndex = 0;
    startIndex = startIndex + 1; /* motion speed */
    
    FillLEDsFromPaletteColors( startIndex);
    
    FastLED.show();
    FastLED.delay(1000 / UPDATES_PER_SECOND);
}

void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
    uint8_t brightness = 255;
    
    for( int i = 0; i < NUM_LED1; i++)  {
        ledsA[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
//        LedsB[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);   
        colorIndex += 3;    
   }
 }


// There are several different palettes of colors demonstrated here.
//
// FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
// OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
//
// Additionally, you can manually define your own color palettes, or you can write
// code that creates color palettes on the fly.  All are shown here.

void ChangePalettePeriodically()
{
    uint8_t secondHand = (millis() / 1000) % 60;
    static uint8_t lastSecond = 99;
    
    if( lastSecond != secondHand) {
        lastSecond = secondHand;
        if( secondHand ==  0)  { currentPalette = RainbowColors_p;         currentBlending = LINEARBLEND; }
        if( secondHand == 10)  { currentPalette = RainbowStripeColors_p;   currentBlending = NOBLEND;  }
        if( secondHand == 15)  { currentPalette = RainbowStripeColors_p;   currentBlending = LINEARBLEND; }
        if( secondHand == 20)  { SetupPurpleAndGreenPalette();             currentBlending = LINEARBLEND; }
        if( secondHand == 25)  { SetupTotallyRandomPalette();              currentBlending = LINEARBLEND; }
        if( secondHand == 30)  { SetupBlackAndWhiteStripedPalette();       currentBlending = NOBLEND; }
        if( secondHand == 35)  { SetupBlackAndWhiteStripedPalette();       currentBlending = LINEARBLEND; }
        if( secondHand == 40)  { currentPalette = CloudColors_p;           currentBlending = LINEARBLEND; }
        if( secondHand == 45)  { currentPalette = PartyColors_p;           currentBlending = LINEARBLEND; }
        if( secondHand == 50)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = NOBLEND;  }
        if( secondHand == 55)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = LINEARBLEND; }
    }
}

// This function fills the palette with totally random colors.
void SetupTotallyRandomPalette()
{
    for( int i = 0; i < 16; i++) {
        currentPalette[i] = CHSV( random8(), 255, random8());
    }
}

// This function sets up a palette of black and white stripes,
// using code.  Since the palette is effectively an array of
// sixteen CRGB colors, the various fill_* functions can be used
// to set them up.
void SetupBlackAndWhiteStripedPalette()
{
    // 'black out' all 16 palette entries...
    fill_solid( currentPalette, 16, CRGB::Black);
    // and set every fourth one to white.
    currentPalette[0] = CRGB::White;
    currentPalette[4] = CRGB::White;
    currentPalette[8] = CRGB::White;
    currentPalette[12] = CRGB::White;
    
}

// This function sets up a palette of purple and green stripes.
void SetupPurpleAndGreenPalette()
{
    CRGB purple = CHSV( HUE_PURPLE, 255, 255);
    CRGB green  = CHSV( HUE_GREEN, 255, 255);
    CRGB black  = CRGB::Black;
    
    currentPalette = CRGBPalette16(
                                   green,  green,  black,  black,
                                   purple, purple, black,  black,
                                   green,  green,  black,  black,
                                   purple, purple, black,  black );
}


// This example shows how to set up a static color palette
// which is stored in PROGMEM (flash), which is almost always more
// plentiful than RAM.  A static PROGMEM palette like this
// takes up 64 bytes of flash.
const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
    CRGB::Red,
    CRGB::Gray, // 'white' is too bright compared to red and blue
    CRGB::Blue,
    CRGB::Black,
    
    CRGB::Red,
    CRGB::Gray,
    CRGB::Blue,
    CRGB::Black,
    
    CRGB::Red,
    CRGB::Red,
    CRGB::Gray,
    CRGB::Gray,
    CRGB::Blue,
    CRGB::Blue,
    CRGB::Black,
    CRGB::Black
};



// Additional notes on FastLED compact palettes:
//
// Normally, in computer graphics, the palette (or "color lookup table")
// has 256 entries, each containing a specific 24-bit RGB color.  You can then
// index into the color palette using a simple 8-bit (one byte) value.
// A 256-entry color palette takes up 768 bytes of RAM, which on Arduino
// is quite possibly "too many" bytes.
//
// FastLED does offer traditional 256-element palettes, for setups that
// can afford the 768-byte cost in RAM.
//
// However, FastLED also offers a compact alternative.  FastLED offers
// palettes that store 16 distinct entries, but can be accessed AS IF
// they actually have 256 entries; this is accomplished by interpolating
// between the 16 explicit entries to create fifteen intermediate palette
// entries between each pair.
//
// So for example, if you set the first two explicit entries of a compact 
// palette to Green (0,255,0) and Blue (0,0,255), and then retrieved 
// the first sixteen entries from the virtual palette (of 256), you'd get
// Green, followed by a smooth gradient from green-to-blue, and then Blue.

Updated whit working sketch

 LedsB[i] =

but you define:-

CRGB ledsB[NUM_LED2];

Variables are case sensitive so these are two different variables.

:sweat_smile:
awesome thx did not know and not notice

after a few cyles strip 1 stops working,
I think that might due the cyle round now being NUM_LED1
but needs to be NUM_LED1 + NUM_LED2

how do i define those 2 to 1 value?

#define NUM_LEDS_TOTAL = NUM_LED1 + NUM_LED2

#define NUM_LEDS_TOTAL NUM_LED1 + NUM_LED2

#define NUM_LEDS_TOTAL  = NUM_LED1 + NUM_LED2

Why do you want to define the total number of LEDs?
You have two strips so these should be handled separately. I can’t see why you need the total number.

I want to make a loop that is defined by the amount of leds,
The amount of leds differences per led stip per pin.

had success doing 2 led strip and even amount of leds, now I'm trying to add 3 strip and looking how to deal whit uneven amount's of leds per strip.
goal is to get up to 10 small led strip.
The strip I want to use are small and the data line can not be connected in a loop,

I'm using

int NUM_LEDS_TOTAL[] = { NUM_LED_STRIP_1,NUM_LED_STRIP_2 }

to get the tolal number of leds to count my loop.

Dot moving around 2 led strips

#include <FastLED.h>
#define NUM_LED_STRIP_1 14
#define NUM_LED_STRIP_2 14
#define LED_PIN_A 3
#define LED_PIN_B 5
#define NUM_STRIPS 2
#define NUM_LEDS_PER_STRIP 14

#define BRIGHTNESS  10
#define UPDATES_PER_SECOND 10   // Set Speed 
#define LED_TYPE    WS2812B
CRGB leds[NUM_LED_STRIP_1][NUM_LED_STRIP_2];

void setup() {
  delay( 3000 ); // power-up safety delay
  //   Ledtype - ledPin - Coller order -  
  FastLED.addLeds<LED_TYPE, LED_PIN_A, GRB>(leds[0], NUM_LED_STRIP_1);
  FastLED.addLeds<LED_TYPE, LED_PIN_B, GRB>(leds[1], NUM_LED_STRIP_2);
  FastLED.setBrightness(  BRIGHTNESS );

}

void loop() {
   static uint8_t hue = 0;
   uint8_t brightness = 255;
  // This outer loop will go over each strip, one at a time
  for(int x = 0; x < NUM_STRIPS; x++) {
    // This inner loop will go over each led in the current strip, one at a time
    for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
      leds[x][i] = CRGB::Red;
      FastLED.show();
      leds[x][i] = CRGB::Black;
      delay(100);
      FastLED.clear();
    }
  }
}

Atempt to expand to 3 strips :cold_sweat:

#include <FastLED.h>

// Moves a Coller dot around over the multiepul led strips if it is one.



#define NUM_LED_STRIP_1 14
#define NUM_LED_STRIP_2 14
#define NUM_LED_STRIP_3 20
#define NUM_STRIPS 2
#define NUM_STRIPS 3
#define NUM_LEDS_PER_STRIP 14

#define LED_PIN_A 3
#define LED_PIN_B 5
#define LED_PIN_C 10
#define UPDATES_PER_SECOND 10   // Set Speed 
#define BRIGHTNESS  10
#define LED_TYPE    WS2812B



CRGB leds[NUM_LED_STRIP_1][NUM_LED_STRIP_2];

// Etempts to get a tolal valeu of leds wen adding more strips 
//val NUM_LEDS_TOTAL[] = { NUM_LED_STRIP_1,NUM_LED_STRIP_2,NUM_LED_STRIP_3 };
//CRGB leds[NUM_LED_STRIP_1][NUM_LED_STRIP_2][NUM_LED_STRIP_2];
//CRGB leds[NUM_LEDS_TOTAL];




void setup() {
   delay( 3000 ); // power-up safety delay

  FastLED.addLeds<LED_TYPE, LED_PIN_A, GRB>(leds[0], NUM_LED_STRIP_1);
  FastLED.addLeds<LED_TYPE, LED_PIN_B, GRB>(leds[1], NUM_LED_STRIP_2);
///  not sure how to expant from here out 
//  FastLED.addLeds<LED_TYPE, LED_PIN_C, GRB>(leds[2], NUM_LED_STRIP_2);
//  FastLED.addLeds<LED_TYPE, LED_PIN_C, GRB>(leds[2], NUM_LEDS_TOTAL);
  FastLED.setBrightness(  BRIGHTNESS );

 

}


void loop() {
  
  static uint8_t hue = 0;
    uint8_t brightness = 255;
    
  for (int x =0; x<NUM_STRIPS; x++) {
      int  NUM_LEDS_TOTAL[] = { NUM_LED_STRIP_1,NUM_LED_STRIP_2 };
 
 //   int  NUM_LEDS_TOTAL[] = { NUM_LED_STRIP_1,NUM_LED_STRIP_2,NUM_LED_STRIP_3 };
      for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
      // Turn our current led on to white/green, then show the leds
      leds[x][i] = CRGB::Blue;
     

      
      FastLED.show();



     // Wait a little bit
  //    delay(1000 / UPDATES_PER_SECOND);

      // Turn our current led back to black for the next loop around
     leds[x][i] = CRGB::Black;
     delay(1000 / UPDATES_PER_SECOND);
    }
}
}

I'm googling a lot and every day I find something to help me get a step further ;D

I've seen people using a array to get the amount of leds,
or using 2 values for it, but I'm stuck in what do if leds is a some of all the leds per strip added up :cold_sweat:

I would suggest you are going about it in the wrong way. You are treating the strips as if they were the same size and as you say they are not.

If your aim is to have a single lit pixel, appeared to go from strip to strip you should treat them separately. Do the lit led shifting for one strip and only when that ends do the next strip, and so on. So each strip is only run for the length of that strip.

Yes you can use an array but I don’t think it buys you anything here.

Grumpy_Mike:
If your aim is to have a single lit pixel.

No I'm not but i need to start somewhere ;D

wen I get a dot to work i can add all short of loop animations and stuff.
I can easy add none related loop animations later,
But I found most of the animations gave the same effect if you would connect every thing to the same pin.
yes can do every strip whit a different color or animation.
Bu the real coolnes comes wen you have lot's of different argb strips/devices that use loop effect's to go from one to the next and behave as a to be part of 1 strip wile there clearly not.

Total it will be around 7 x 15 leds, 1 x 60 leds and 2 x 44 leds, later I will be adding more know knows :smiley:
I was thinking, if i can def the total mun of leds,
in a short of some then on that way I can tell the pixel ware it needs to be, of course I can just type in all the amount of leds my self :roll_eyes:

Bu the real coolnes comes wen you have lot's of different argb strips/devices that use loop effect's to go from one to the next and behave as a to be part of 1 strip wile there clearly not.

So what you need to do is to write a function that accepts a virtual led number and sorts out what real strip and real pin to use to set the led. Then when ever you want to do a joined up animation, just call this function instead of directly writing to a strip.

Well that is what I'm trying to do, just I'm going all wrong in doing in it. :confused:

My thought was If count up all the amount of leds per strip tell ware ech strips starts, put then in a loop I have a reference point to use and and have short of virtual led number map of every led.
And by that I can lay out routs by using a led number that the dot can take.

here is a drawing I made from what I have in mind, the shapes lengths amounts or order are not final jet, it's serves just ass example

Ok the problem with a complex system like this is that you will want to map the pattern yourself. That is you have to have an array of all the positions where you want the LED to occur. There is no generic way of doing this, because you want forward and back motion up and down the strips.

That image does not show up on my iPad, but it shows up on my laptop.

I can make a array of the led nr per strip, but I'm stuck in how to use that

int Loop_order1_StripA[] = {1,2,3,4};
int Loop_order2_StripB[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};
int Loop_order3_StripA[] = {5,6,7,8,9};
int Loop_order4_StripC[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};
int Loop_order5_StripA[] = {10,11,12,13,14};    

 
   
      
   int  NUM_LEDS_TOTAL[] = { NUM_LED_STRIP_1,NUM_LED_STRIP_2,NUM_LED_STRIP_3 };
      for(int x = 0; x < NUM_LEDS_TOTAL; x++) {
      // Runs a Coller dot around 
      ledsA[Loop_order1_StripA] = CRGB::Blue;
      ledsB[Loop_order2_StripB] = CRGB::Blue;
      ledsA[Loop_order3_StripA] = CRGB::Blue;
      ledsC[Loop_order4_StripC] = CRGB::Blue;
      ledsA[Loop_order5_StripA] = CRGB::Blue;
#include <FastLED.h>

// Moves a Coller dot around over the multiepul led strips if it is one.



#define NUM_LED_STRIP_1 14
#define NUM_LED_STRIP_2 14
#define NUM_LED_STRIP_3 14
//#define NUM_STRIPS 2
#define NUM_STRIPS 3
#define NUM_LEDS_PER_STRIP 14

#define LED_PIN_A 3
#define LED_PIN_B 5
#define LED_PIN_C 10
#define UPDATES_PER_SECOND 10   // Set Speed 
#define BRIGHTNESS  10
#define LED_TYPE    WS2812B


CRGB ledsA[NUM_LED_STRIP_1];
CRGB ledsB[NUM_LED_STRIP_2];
CRGB ledsC[NUM_LED_STRIP_3];
CRGB ledsT[42];





void setup() {
   delay( 3000 ); // power-up safety delay

  FastLED.addLeds<LED_TYPE, LED_PIN_A, GRB>(ledsA, NUM_LED_STRIP_1);
  FastLED.addLeds<LED_TYPE, LED_PIN_B, GRB>(ledsB, NUM_LED_STRIP_2);
  FastLED.addLeds<LED_TYPE, LED_PIN_C, GRB>(ledsC, NUM_LED_STRIP_3);

  FastLED.setBrightness(  BRIGHTNESS );



}


void loop() {
  static uint8_t hue = 0;
   uint8_t brightness = 255;

int Loop_order1_StripA[] = {1,2,3,4};
int Loop_order2_StripB[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};
int Loop_order3_StripA[] = {5,6,7,8,9};
int Loop_order4_StripC[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14};
int Loop_order5_StripA[] = {10,11,12,13,14};    

 
   
      
   int  NUM_LEDS_TOTAL[] = { NUM_LED_STRIP_1,NUM_LED_STRIP_2,NUM_LED_STRIP_3 };
      for(int x = 0; x < NUM_LEDS_TOTAL; x++) {
      // Runs a Coller dot around 
      ledsA[Loop_order1_StripA] = CRGB::Blue;
      ledsB[Loop_order2_StripB] = CRGB::Blue;
      ledsA[Loop_order3_StripA] = CRGB::Blue;
      ledsC[Loop_order4_StripC] = CRGB::Blue;
      ledsA[Loop_order5_StripA] = CRGB::Blue;
      
      FastLED.show();



       // Turn our current led back to black for the next loop around
    // ledsA[01] = CRGB::Black;
     delay(1000 / UPDATES_PER_SECOND);
    }
}
//}

I can make a array of the led nr per strip, but I'm stuck in how to use that

No you have not made an array defining the pattern you want. In fact I am not sure what those arrays do for you at all. They don't work to define anything.

The array that defines the pattern must do so by using a virtual pixel number. Then you use the converter function I spoke about before to convert the virtual number into an actual one and strip.

That image seems to have disappeared, have you removed it? The link doesn't work either. I do wish you would stop messing about with image sharing sites and post images correctly. Fortunately I still have a copy in my download folder. I have added virtual and real pixel numbers to the diagram.

Now you will see the first strip pixel number and real pixel number are the same. So to convert any virtual number between 0 and 22 simply do:-

if(virtual <= 22){
   // write to virtual number on strip 1
}

next if the virtual pixel number is greater than 22 and less than or equal to 30 write to strip 2

if(virtual > 22 && virtual <= 30){
   // write to virtual number - 22 on strip 2
}

next if the virtual pixel number is greater than 30 and less than or equal to 38 write to strip 4

if(virtual > 30 && virtual <= 38){
   // write to virtual number - 30 on strip 4
}

next if the virtual pixel number is greater than 38 and less than or equal to 45 write to strip 3

if(virtual > 38 && virtual <= 45){
   // write to virtual number - 38 on strip 3
}

finally if the virtual pixel number is greater than 45 and less than or equal to 52 write to strip 5

if(virtual > 45 && virtual <= 52){
   // write to virtual number - 45 on strip 5
}

Add those together to make your translation function. You can also pass the colour number you want to write to this function.

That image seems to have disappeared, have you removed it?

no I been have using <img][/img> and putting in direct link of the html adres of the picture, since first share, don't know why it is not loading sometimes.
I did change it to the upload html link of the arduino forum you used wen you showed it, but I noticed that the link upload was gone at some point, and changed it back,
I think now its showing correct, I will not keep editing it, sorry for that :grin: just want to do it right, don't know how to link a attachment into the post

There is also a direct link for wen it not is loading

I'm reading up on virtual function.

I was thinking how I would have done it as in a spreadsheet

there I would have used a loop order look as this
A1 to A4
B1 to B14
A5 to A9
C1 to C14
A10 to A14

and have A to C define witch strip it is and the nr witch led it is

don't know how to link a attachment into the post

Once it is posted as an attachment left click on the link and copy the link. Then choose the modify option and click the picture icon. Paste in what you have copied.

I'm reading up on virtual function.

No please don't, I spent nearly an hour on that last post. It is not a virtual function you want, that is something different. You want to use virtual LED numbers like I explained.

If you don't understand what I explained then ask specifically about what you are not understanding.

I was thinking how I would have done it as in a spreadsheet

If you keep going off at a tangent then you will never understand what I am trying to tell you.

there I would have used a loop order look as this

No you wouldn't.

don't understand what I explained then ask specifically about what you are not understanding.

Don't under stand the part ware I turn the leds strips into virtual LED numbers,

can I not get that by referring al the strips in order?

Don't know if I'm defining ranges right this way, but any way I'm unsure how to implement this.

Test setup
StripA = {1~14};
StripB = {15~30};
StripC = {31~45};
DotRout =1~5,15~30,6~10,30~45,11~15

How it looks in the picture just example 

 StripA = {1~22}
 StripB = {23~30}
 StripC = {39~45}
 StripD = {31~38}
 StripE = {46~52}

DotRout = 1~10,23~30,11~15,39~45,45~39,13~18,31~38,19~21,46~52,51~46,22

Don't know if I'm defining ranges right this way

You are not.

First you put your dot route in an array, you have to specify every number the dot wants to visit.

byte DotRout [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
          23, 24, 25, 26, 27, 28, 29, 30,
          11, 12, 13, 14, 15,
          39, 40, 41, 42, 43, 44,
          45, 44, 43, 42, 41, 40, 39,
          13, 14, 15, 16, 17, 18,
          31, 32, 33, 34, 35, 36, 37, 38,
          19, 20, 21,
          46, 47, 48, 49, 50, 51, 52,
          51, 50, 49, 48, 47, 46,
          22};

Now you just need to have a loop that goes for the number of steps in this array.

for(int i=0; i<len(DotRout); i++) {
             // for each iteration you call the translation routine passing it the number DotRout[i]
}

And that is it. You don't have to have any other arrays defined. Just this one.

can I not get that by referring al the strips in order?

No.

Don't under stand the part ware I turn the leds strips into virtual LED numbers,

I have given you each line of the code. Put them all together and replace the comment with the real call to set the pixel.