Go Down

Topic: The effect is not applied to the entire length of the strip (Read 161 times) previous topic - next topic

crristib

Hello!

I'm new here, I want you to help me with a problem I can not solve.
I'm trying to get the same effect for two sections of LED strip (six LEDs each) and I notice that my code is not working properly.
It seems that the rainbow animation does not apply to all the lanes in the strip, each of them having the same color.
What might be the problem, I mention it is a new field for me. :)
I put down the code I use.
Thank you.
Code: [Select]
#include <FastLED.h>
#define LED_PIN_S1     10
#define NUM_LEDS_S1    12
#define BRIGHTNESS_S1  150
#define LED_TYPE_S1    WS2812B
#define COLOR_ORDER_S1 GRB
CRGB ledsA[NUM_LEDS_S1];
#define UPDATES_PER_SECOND_S1 100
int myLEDs0[6] = {0, 1, 2, 3, 4, 5};
int myLEDs1[6] = {11, 10, 9, 8, 7, 6};
int x;
int i;

// This example shows how to cross-fade between different color palettes
// using the function nblendPaletteTowardPalette.
//
// The basic idea is that you always have a "current palette" that you're
// pulling colors from with ColorFromPalette, and you have a "target palette"
// which is the 'next' palette that you want to get to.
//
// After that, implementation is relatively simple: just periodically call
//   nblendPaletteTowardPalette( currentPalette, targetPalette);
// If the current palette is not yet equal to the target palette, this
// function will make a few small changes to the current palette to make
// it slightly more like the target.  Over time, the current palette will
// come to be equal to the target.
// There's no need to test the current and target for equality; it's safe
// to keep calling nblendPaletteTowardPalette even after current reaches target.
// For faster blending, call nblendPaletteTowardPalette twice per loop.

CRGBPalette16 currentPalette;

extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;

int paletteCounter;
void setup() {
delay( 3000 ); // power-up safety delay
  FastLED.addLeds<LED_TYPE_S1, LED_PIN_S1, COLOR_ORDER_S1>(ledsA, NUM_LEDS_S1).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(BRIGHTNESS_S1);
}
void loop(){
ChangePalettePeriodically();
 // Crossfade current palette slowly toward the target palette
  //
  // Each time that nblendPaletteTowardPalette is called, small changes
  // are made to currentPalette to bring it closer to matching targetPalette.
  // You can control how many changes are made in each call:
  //   - the default of 24 is a good balance
  //   - meaningful values are 1-48.  1=veeeeeeeery slow, 48=quickest
  //   - "0" means do not change the currentPalette at all; freeze
uint8_t maxChanges = 0;
  static uint8_t startIndex = 0;
  startIndex = startIndex + 1; /* motion speed */
  FillLEDsFromPaletteColors( startIndex);
  FastLED.show();
  FastLED.delay(1000 / UPDATES_PER_SECOND_S1);
}
void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
  uint8_t brightness = 255;
  for( int i = 0; i < 6; i++) {
    ledsA[myLEDs0[i] ] = x;
  }
  for (i = 0; i < 6; i++)
  {
    ledsA[myLEDs0[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8(i*16), brightness);  //change palette or colors.
    colorIndex += 3;
  }
  for( int i = 0; i < 6; i++) {
  ledsA[myLEDs1[i] ] = x;
}
  for (i = 0; i < 6; i++)  
  {  
    ledsA[myLEDs1[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8(i*16), brightness);  //change palette or colors.
    colorIndex += 3;
    }
}
void ChangePalettePeriodically()
  {  
    if( paletteCounter == 0)   { fill_solid( currentPalette, 16, CRGB::Red); currentBlending = NOBLEND;}
    if( paletteCounter == 1)   { fill_solid( currentPalette, 16, CRGB::Crimson); currentBlending = NOBLEND;}
    if( paletteCounter == 2)   { fill_solid( currentPalette, 16, CRGB::Orange); currentBlending = NOBLEND;}
    if( paletteCounter == 3)   { fill_solid( currentPalette, 16, CRGB::DarkOrange); currentBlending = NOBLEND;}
    if( paletteCounter == 4)   { fill_solid( currentPalette, 16, CRGB::Yellow); currentBlending = NOBLEND;}
    if( paletteCounter == 5)   { fill_solid( currentPalette, 16, CRGB::Gold); currentBlending = NOBLEND;}
    if( paletteCounter == 6)   { fill_solid( currentPalette, 16, CRGB::Green); currentBlending = NOBLEND;}
    if( paletteCounter == 7)   { fill_solid( currentPalette, 16, CRGB::GreenYellow); currentBlending = NOBLEND;}
    if( paletteCounter == 8)   { fill_solid( currentPalette, 16, CRGB::Lime); currentBlending = NOBLEND;}  
    if( paletteCounter == 9)   { fill_solid( currentPalette, 16, CRGB::Blue); currentBlending = NOBLEND;}  
    if( paletteCounter == 10)  { fill_solid( currentPalette, 16, CRGB::Aqua); currentBlending = NOBLEND;}  
    if( paletteCounter == 11)  { fill_solid( currentPalette, 16, CRGB::DarkTurquoise); currentBlending = NOBLEND;}
    if( paletteCounter == 12)  { fill_solid( currentPalette, 16, CRGB::Navy); currentBlending = NOBLEND;}
    if( paletteCounter == 13)  { fill_solid( currentPalette, 16, CRGB::Purple); currentBlending = NOBLEND;}        
    if( paletteCounter == 14)  { fill_solid( currentPalette, 16, CRGB::Violet); currentBlending = NOBLEND;}    
    if( paletteCounter == 15)  { fill_solid( currentPalette, 16, CRGB::DeepPink); currentBlending = NOBLEND;}
    if( paletteCounter == 16)  { fill_solid( currentPalette, 16, CRGB::LightCoral); currentBlending = NOBLEND;}
    if( paletteCounter == 17)  { fill_solid( currentPalette, 16, CRGB::White); currentBlending = NOBLEND;}
    if( paletteCounter == 18)  { fill_solid( currentPalette, 16, CRGB::BurlyWood); currentBlending = NOBLEND;}
    if( paletteCounter == 19)  { fill_solid( currentPalette, 16, CRGB::Thistle); currentBlending = NOBLEND;}  
    if( paletteCounter == 20)  { fill_solid( currentPalette, 16, CRGB::White); currentBlending = NOBLEND;}    
    if( paletteCounter == 21)  { currentPalette = RainbowColors_p;         currentBlending = NOBLEND;  }
    if( paletteCounter == 22)  { currentPalette = RainbowStripeColors_p;   currentBlending = NOBLEND;  }
    if( paletteCounter == 23)  { currentPalette = OceanColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 24)  { currentPalette = CloudColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 25)  { currentPalette = LavaColors_p;            currentBlending = NOBLEND;  }
    if( paletteCounter == 26)  { currentPalette = ForestColors_p;          currentBlending = NOBLEND;  }
    if( paletteCounter == 27)  { currentPalette = PartyColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 28)  { SetupPurpleAndGreenPalette();             currentBlending = LINEARBLEND; }
    if( paletteCounter == 29)  { SetupTotallyRandomPalette();              currentBlending = LINEARBLEND; }
    if( paletteCounter == 30)  { SetupBlackAndWhiteStripedPalette();       currentBlending = NOBLEND; }
    if( paletteCounter == 31)  { SetupBlackAndWhiteStripedPalette();       currentBlending = LINEARBLEND; }
    if( paletteCounter == 32)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = NOBLEND;  }
    if( paletteCounter == 33)  { 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
};










Grumpy_Mike

Quote
'm trying to get the same effect for two sections of LED strip (six LEDs each)
You have two arrays. If you want to display them on one strip you must have one array. If you want to have two separate patterns then you need to just work on one half of the array at once. That is index 0 to 5, for the first and index 6 to 11 for the second.

Hint:- when you write the same line over and over and over, it is time to learn more about arrays and loops. Like in your ChangePalettePeriodically function.

crristib

Thank you for the answers.

I tried with one pattern: int myLEDs [] = {0,1,2,3,4,5,6,7,8,9,10,11};
And if i use index 0-5 and 6-11, two LEDs do not turn on. (one on each pattern).
I mention that in this way a pattern works correctly, one works the same as before.
I have tried with solid colors and it works, a different color on the pattern.
Rainbow does not work.

Grumpy_Mike

Quote
two LEDs do not turn on. (one on each pattern).
Which two?
This is probably the result of an error in your code.

Quote
I have tried with solid colors and it works, a different color on the pattern.
Rainbow does not work.
Again this is probably the result of an error in your code.

Post the code that does not work. Maybe only one of them at a time because you are maybe making the same mistake in both.

crristib

Does not work, the last LED from each section.


I put a picture, basically looks like this.
Where the black appears, the LEDs do not work.

http://imgur.com/yZf7uYx





I use this code:

Code: [Select]
#include <FastLED.h>
#define LED_PIN     10 //LED strip case top back.
#define NUM_LEDS    12
#define BRIGHTNESS  150
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 50
int myLEDs[] = {0,1,2,3,4,5,6,7,8,9,10,11};
int x;
int i;
// This example shows how to cross-fade between different color palettes
// using the function nblendPaletteTowardPalette.
//
// The basic idea is that you always have a "current palette" that you're
// pulling colors from with ColorFromPalette, and you have a "target palette"
// which is the 'next' palette that you want to get to.
//
// After that, implementation is relatively simple: just periodically call
//   nblendPaletteTowardPalette( currentPalette, targetPalette);
// If the current palette is not yet equal to the target palette, this
// function will make a few small changes to the current palette to make
// it slightly more like the target.  Over time, the current palette will
// come to be equal to the target.
// There's no need to test the current and target for equality; it's safe
// to keep calling nblendPaletteTowardPalette even after current reaches target.
// For faster blending, call nblendPaletteTowardPalette twice per loop.
CRGBPalette16 currentPalette;
TBlendType currentBlending;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
int paletteCounter;
void setup() {
  delay( 3000 ); // power-up safety delay
  FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(BRIGHTNESS);
}
void loop(){
  ChangePalettePeriodically();
  // Crossfade current palette slowly toward the target palette
  //
  // Each time that nblendPaletteTowardPalette is called, small changes
  // are made to currentPalette to bring it closer to matching targetPalette.
  // You can control how many changes are made in each call:
  //   - the default of 24 is a good balance
  //   - meaningful values are 1-48.  1=veeeeeeeery slow, 48=quickest
  //   - "0" means do not change the currentPalette at all; freeze
  uint8_t maxChanges = 0;
  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 < 5; i++) {
    leds[myLEDs[i] ] = x;
  }
  for (i = 0; i < 5; i++) {
    leds[myLEDs[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8(i*16), brightness);  //change palette or colors.
    colorIndex += 3;
}
  for( int i = 6; i < 11 ; i++) {
  leds[myLEDs[i] ] = x;
}
  for (i = 6; i < 11; i++)  
  {  
    leds[myLEDs[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8(i*16), brightness);  //change palette or colors.
    colorIndex += 3;
    }
}
  void ChangePalettePeriodically()
  {  
    if( paletteCounter == 0)   { fill_solid( currentPalette, 16, CRGB::Red); currentBlending = NOBLEND;}
    if( paletteCounter == 1)   { fill_solid( currentPalette, 16, CRGB::Crimson); currentBlending = NOBLEND;}
    if( paletteCounter == 2)   { fill_solid( currentPalette, 16, CRGB::Orange); currentBlending = NOBLEND;}
    if( paletteCounter == 3)   { fill_solid( currentPalette, 16, CRGB::DarkOrange); currentBlending = NOBLEND;}
    if( paletteCounter == 4)   { fill_solid( currentPalette, 16, CRGB::Yellow); currentBlending = NOBLEND;}
    if( paletteCounter == 5)   { fill_solid( currentPalette, 16, CRGB::Gold); currentBlending = NOBLEND;}
    if( paletteCounter == 6)   { fill_solid( currentPalette, 16, CRGB::Green); currentBlending = NOBLEND;}
    if( paletteCounter == 7)   { fill_solid( currentPalette, 16, CRGB::GreenYellow); currentBlending = NOBLEND;}
    if( paletteCounter == 8)   { fill_solid( currentPalette, 16, CRGB::Lime); currentBlending = NOBLEND;}  
    if( paletteCounter == 9)   { fill_solid( currentPalette, 16, CRGB::Blue); currentBlending = NOBLEND;}  
    if( paletteCounter == 10)  { fill_solid( currentPalette, 16, CRGB::Aqua); currentBlending = NOBLEND;}  
    if( paletteCounter == 11)  { fill_solid( currentPalette, 16, CRGB::DarkTurquoise); currentBlending = NOBLEND;}
    if( paletteCounter == 12)  { fill_solid( currentPalette, 16, CRGB::Navy); currentBlending = NOBLEND;}
    if( paletteCounter == 13)  { fill_solid( currentPalette, 16, CRGB::Purple); currentBlending = NOBLEND;}        
    if( paletteCounter == 14)  { fill_solid( currentPalette, 16, CRGB::Violet); currentBlending = NOBLEND;}    
    if( paletteCounter == 15)  { fill_solid( currentPalette, 16, CRGB::DeepPink); currentBlending = NOBLEND;}
    if( paletteCounter == 16)  { fill_solid( currentPalette, 16, CRGB::LightCoral); currentBlending = NOBLEND;}
    if( paletteCounter == 17)  { fill_solid( currentPalette, 16, CRGB::White); currentBlending = NOBLEND;}
    if( paletteCounter == 18)  { fill_solid( currentPalette, 16, CRGB::BurlyWood); currentBlending = NOBLEND;}
    if( paletteCounter == 19)  { fill_solid( currentPalette, 16, CRGB::Thistle); currentBlending = NOBLEND;}  
    if( paletteCounter == 20)  { fill_solid( currentPalette, 16, CRGB::White); currentBlending = NOBLEND;}    
    if( paletteCounter == 21)  { currentPalette = RainbowColors_p;         currentBlending = NOBLEND;  }
    if( paletteCounter == 22)  { currentPalette = RainbowStripeColors_p;   currentBlending = NOBLEND;  }
    if( paletteCounter == 23)  { currentPalette = OceanColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 24)  { currentPalette = CloudColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 25)  { currentPalette = LavaColors_p;            currentBlending = NOBLEND;  }
    if( paletteCounter == 26)  { currentPalette = ForestColors_p;          currentBlending = NOBLEND;  }
    if( paletteCounter == 27)  { currentPalette = PartyColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 28)  { SetupPurpleAndGreenPalette();             currentBlending = LINEARBLEND; }
        if( paletteCounter == 30)  { SetupBlackAndWhiteStripedPalette();       currentBlending = NOBLEND; }
    if( paletteCounter == 31)  { SetupBlackAndWhiteStripedPalette();       currentBlending = LINEARBLEND; }
    if( paletteCounter == 32)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = NOBLEND;  }
    if( paletteCounter == 33)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = LINEARBLEND; }
    }
// 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
};





Grumpy_Mike

The for loops are wrong, you are stopping them too soon.
Code: [Select]

so the two like this
for( int i = 0; i < 5; i++)
should be
for( int i = 0; i < 6; i++)

and the two like this
for( int i = 6; i < 11 ; i++)
should be
for( int i = 6; i < 12 ; i++)


When you write a for loop it goes on while i < the number in the middle. It never reaches the number in the middle but stops one short. Beginners don't notice this because things like
Code: [Select]
for( int i = 0; i < 5; i++)
make 5 iterations but the value of i goes from 0 to 4 - that is five iterations.

crristib

Now, all the LEDs works, thank you, but i go back to my old problem.
On a pattern the LEDs do not work properly.
If i apply the code for four LEDs on each pattern, everything is correct, but I have six on each pattern.

I put a picture, where this can be seen.
http://imgur.com/oiALRw9

Grumpy_Mike

Quote
On a pattern the LEDs do not work properly.
So post the code and lets see if we can spot where the error is.

Here is how to post a picture here image guide

crristib


This is the code:

Code: [Select]
#include <FastLED.h>
#define LED_PIN     10 //LED strip case top back.
#define NUM_LEDS    12
#define BRIGHTNESS  150
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 50
int myLEDs[] = {0,1,2,3,4,5,6,7,8,9,10,11};
int x;
int i;
// This example shows how to cross-fade between different color palettes
// using the function nblendPaletteTowardPalette.
//
// The basic idea is that you always have a "current palette" that you're
// pulling colors from with ColorFromPalette, and you have a "target palette"
// which is the 'next' palette that you want to get to.
//
// After that, implementation is relatively simple: just periodically call
//   nblendPaletteTowardPalette( currentPalette, targetPalette);
// If the current palette is not yet equal to the target palette, this
// function will make a few small changes to the current palette to make
// it slightly more like the target.  Over time, the current palette will
// come to be equal to the target.
// There's no need to test the current and target for equality; it's safe
// to keep calling nblendPaletteTowardPalette even after current reaches target.
// For faster blending, call nblendPaletteTowardPalette twice per loop.
CRGBPalette16 currentPalette;
TBlendType currentBlending;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
int paletteCounter;
void setup() {
  delay( 3000 ); // power-up safety delay
  FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(BRIGHTNESS);
}
void loop(){
  ChangePalettePeriodically();
  // Crossfade current palette slowly toward the target palette
  //
  // Each time that nblendPaletteTowardPalette is called, small changes
  // are made to currentPalette to bring it closer to matching targetPalette.
  // You can control how many changes are made in each call:
  //   - the default of 24 is a good balance
  //   - meaningful values are 1-48.  1=veeeeeeeery slow, 48=quickest
  //   - "0" means do not change the currentPalette at all; freeze
  uint8_t maxChanges = 0;
  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 < 6; i++) {
    leds[myLEDs[i] ] = x;
  }
  for (i = 0; i < 6; i++) {
    leds[myLEDs[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8(i*16), brightness);  //change palette or colors.
    colorIndex += 3;
}
  for( int i = 6; i < 12 ; i++) {
  leds[myLEDs[i] ] = x;
}
  for (i = 6; i < 12; i++)  
  {  
    leds[myLEDs[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8(i*16), brightness);  //change palette or colors.
    colorIndex += 3;
    }
}
  void ChangePalettePeriodically()
  {  
    if( paletteCounter == 0)   { fill_solid( currentPalette, 16, CRGB::Red); currentBlending = NOBLEND;}
    if( paletteCounter == 1)   { fill_solid( currentPalette, 16, CRGB::Crimson); currentBlending = NOBLEND;}
    if( paletteCounter == 2)   { fill_solid( currentPalette, 16, CRGB::Orange); currentBlending = NOBLEND;}
    if( paletteCounter == 3)   { fill_solid( currentPalette, 16, CRGB::DarkOrange); currentBlending = NOBLEND;}
    if( paletteCounter == 4)   { fill_solid( currentPalette, 16, CRGB::Yellow); currentBlending = NOBLEND;}
    if( paletteCounter == 5)   { fill_solid( currentPalette, 16, CRGB::Gold); currentBlending = NOBLEND;}
    if( paletteCounter == 6)   { fill_solid( currentPalette, 16, CRGB::Green); currentBlending = NOBLEND;}
    if( paletteCounter == 7)   { fill_solid( currentPalette, 16, CRGB::GreenYellow); currentBlending = NOBLEND;}
    if( paletteCounter == 8)   { fill_solid( currentPalette, 16, CRGB::Lime); currentBlending = NOBLEND;}  
    if( paletteCounter == 9)   { fill_solid( currentPalette, 16, CRGB::Blue); currentBlending = NOBLEND;}  
    if( paletteCounter == 10)  { fill_solid( currentPalette, 16, CRGB::Aqua); currentBlending = NOBLEND;}  
    if( paletteCounter == 11)  { fill_solid( currentPalette, 16, CRGB::DarkTurquoise); currentBlending = NOBLEND;}
    if( paletteCounter == 12)  { fill_solid( currentPalette, 16, CRGB::Navy); currentBlending = NOBLEND;}
    if( paletteCounter == 13)  { fill_solid( currentPalette, 16, CRGB::Purple); currentBlending = NOBLEND;}        
    if( paletteCounter == 14)  { fill_solid( currentPalette, 16, CRGB::Violet); currentBlending = NOBLEND;}    
    if( paletteCounter == 15)  { fill_solid( currentPalette, 16, CRGB::DeepPink); currentBlending = NOBLEND;}
    if( paletteCounter == 16)  { fill_solid( currentPalette, 16, CRGB::LightCoral); currentBlending = NOBLEND;}
    if( paletteCounter == 17)  { fill_solid( currentPalette, 16, CRGB::White); currentBlending = NOBLEND;}
    if( paletteCounter == 18)  { fill_solid( currentPalette, 16, CRGB::BurlyWood); currentBlending = NOBLEND;}
    if( paletteCounter == 19)  { fill_solid( currentPalette, 16, CRGB::Thistle); currentBlending = NOBLEND;}  
    if( paletteCounter == 20)  { fill_solid( currentPalette, 16, CRGB::White); currentBlending = NOBLEND;}    
    if( paletteCounter == 21)  { currentPalette = RainbowColors_p;         currentBlending = NOBLEND;  }
    if( paletteCounter == 22)  { currentPalette = RainbowStripeColors_p;   currentBlending = NOBLEND;  }
    if( paletteCounter == 23)  { currentPalette = OceanColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 24)  { currentPalette = CloudColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 25)  { currentPalette = LavaColors_p;            currentBlending = NOBLEND;  }
    if( paletteCounter == 26)  { currentPalette = ForestColors_p;          currentBlending = NOBLEND;  }
    if( paletteCounter == 27)  { currentPalette = PartyColors_p;           currentBlending = NOBLEND;  }
    if( paletteCounter == 28)  { SetupPurpleAndGreenPalette();             currentBlending = LINEARBLEND; }
        if( paletteCounter == 30)  { SetupBlackAndWhiteStripedPalette();       currentBlending = NOBLEND; }
    if( paletteCounter == 31)  { SetupBlackAndWhiteStripedPalette();       currentBlending = LINEARBLEND; }
    if( paletteCounter == 32)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = NOBLEND;  }
    if( paletteCounter == 33)  { currentPalette = myRedWhiteBluePalette_p; currentBlending = LINEARBLEND; }
    }
// 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
};

Grumpy_Mike

There is a lot of code here, not all of it used. I would try to change this bit
Code: [Select]
for (i = 6; i < 12; i++) 
  { 
    leds[myLEDs[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8(i*16), brightness);  //change palette or colors.
    colorIndex += 3;
    }
}

To
Code: [Select]
for (i = 6; i < 12; i++) 
  { 
    leds[myLEDs[i]] = ColorFromPalette( currentPalette =RainbowColors_p, colorIndex + sin8((i-6)*16), brightness);  //change palette or colors.
    colorIndex += 3;
    }
}

Note the only change is
Code: [Select]
sin8((i-6)*16)

Go Up