I was wondering if someone could help me with a problem.

gplus
(Johnny Woods (Masamune3210)) #1

I was wondering if someone could help me with a problem. I need to enable blending on a part of this code. No matter what I try I cannot get blending to work.

http://pastebin.com/2r9Fi12S

(JP Roy) #2

Have a look at the FastLED example sketch ‘ColorPalette.ino’ to see in action the effect of…

currentBlending = BLEND;

and…

currentBlending = NOBLEND;

They apply to color palettes and you have none defined !!!

(Johnny Woods (Masamune3210)) #3

I know that. Is there a way to enable blending without a palette defined. I don’t really want to have to use a palette unless i have to as im only using two colors and black

(JP Roy) #4

By blending do you mean smooth transition between one color to another ???

(Johnny Woods (Masamune3210)) #5

Yes, I would like to blend from blue to black

(JP Roy) #6

I guess you are looking for something like this to go from black to red…

for (int j = 0; j < 255; j++) {
for (int i = 0; i < NUM_LEDS_BTAIL; i++) {
bTotal[i] = CRGB(j,0,0);
}

FastLED.show();
delay(10);

}

and here’s the reverse from red to black…

for (int j = 255; j >= 0; j++) {
for (int i = 0; i < NUM_LEDS_BTAIL; i++) {
bTotal[i] = CRGB(j,0,0);
}

FastLED.show();
delay(10);

}

(Johnny Woods (Masamune3210)) #7

Thank you, thats exactly what i was looking for.

(Johnny Woods (Masamune3210)) #8

I have a problem with the code you showed me. I can only get it to fade into a color, i cant figure out how to get it to fade from a color to black. Here is how I’m using my code.

http://pastebin.com/2VEPSdz8

(JP Roy) #9

@Johnny_Woods_Masamun Can you explain how your LEDs are configured between the bbranch and the btail and the btotal ??

(Johnny Woods (Masamune3210)) #10

bTail and bBranch are segments of bTotal on the led layout that i have. They are different strips but are all treated as one array. 14 leds in the tail and 8 leds in the branch

(JP Roy) #11

@Johnny_Woods_Masamun Could you draw or provide a picture of that layout ?

(JP Roy) #12

Sorry, forget about the drawing, just confirm that you have a strip 54 LEDs but it is layout such that you 1st have a tail ot 14 leds followed by 5 branches of 8 LEDs.

(JP Roy) #13

you have many weird statements in that sketch, too many to list here but I think I see your main problem…

replace this…

for (int j = 255; j >= 0; j++) {

with…

for (int j = 255; j >= 0; j–) {

better still replace with…

for (int j = 255; j >= 0; j=-3) {

and in all the other lines just write…

  bTotal[i] = CRGB(0, 0, j); 

and not j*3

(Johnny Woods (Masamune3210)) #14

ok thanks, will try

(JP Roy) #15

ooops… it should be…

for (int j = 255; j >= 0; j-=3) {

(JP Roy) #16

You should delete these lines as they are not needed for your sketch…

CRGB bBranch[NUM_LEDS_BBRANCH];
CRGB bTail[NUM_LEDS_BTAIL];

also…

TBlendType currentBlending;

and also…

currentBlending = BLEND;

As I explained, BLEND is only applicable to palettes !!!

(Johnny Woods (Masamune3210)) #17

Figured it out, Thanks for your help!

(JP Roy) #18

Hi again @Johnny_Woods_Masamun ,

What exactly are trying to do for animation.

Right now, all LEDs of all 5 branches (40 in total) behave exactly the same. Is that what you want ?

(Johnny Woods (Masamune3210)) #19

Is there a way to enable blending on a strip of leds without enabeling a palette. I want to keep away from palettes if i can as i am only using two colors

(JP Roy) #20

@Johnny_Woods_Masamun Didn’t we answer that already ???