Can someone help me? I can't figure this out for the life of me.

fastled-support
gplus
(Kyle bostick) #1

Can someone help me? I can’t figure this out for the life of me. Let me say I am a rookie and if there is a better way to write this effect please re-write it, or tell me how. I just tried to modify an example to create the effect i’m looking for but its not working.

I want to create an “effect” that fills the LED strip from a palette I define, I want to fill the LED strip with at least 6 colors. It can be moving, or non moving. but I do not want to use palette knife. I want it to be filled in an order like Red, White, Yellow, Green, Blue, Orange and just repeat the pattern to fill the entire strip

The “effect” i’m struggling with is on lines 281 and 552-570 of the GIST

The rest of the code is working fine.>>>If I comment out those lines I get no errors

Here is a link to my code

https://gist.github.com/kbostick88/6b4271e6c61612c3082f52d6d7213d57

Here is a link to the error I get

https://gist.github.com/kbostick88/cd14dbc8e8d01d429281808b520553a3
https://gist.github.com/kbostick88/6b4271e6c61612c3082f52d6d7213d57#file-holiday-ino-L1036

(Daniel Garcia) #2

I’m on a bus right now and can’t really dig into this, but it looks like you copied an entire function declaration and dropped it into the middle of other code - which is confusing the compiler, a lot :slight_smile:

(Daniel Garcia) #3

Hopefully someone can work out what exactly it is you want to do with the code in there and help you out (not sure when I will be able to take a closer look at your code)

(Yves BAZIN) #4

@Kyle_bostick

you also need to declare colorIndex
for instance line 289 add
uint8_t colorIndex;

you have copied the function definition inside the code
so do the following

for instance line 1048 add the following:
void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
uint8_t brightness = 255;

for( int i = 0; i < NUM_LEDS-1; i++) {
    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 3;
}

}

then line552 replace :
if (setEffect == “C9”) {
FillLEDsFromPaletteColors( uint8_t colorIndex);
uint8_t brightness = 255;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 3;
}
}
by
if (setEffect == “C9”) {
FillLEDsFromPaletteColors( colorIndex);
}

not sure you will not have other compiling errors but this should correct the ones you currently have

(Kyle bostick) #5

@Yves_BAZIN Thank you for taking the time to write that out. I have made the changes, I am getting an error. I am not sure if i should include “by” if i remove that, most of the errors go away. I have updated the above links and attached a screen shot of the new error without including “by” if i need to add that back, please let me know.

(Kyle bostick) #6

With "by"in the code
missing/deleted image from Google+

(Kyle bostick) #7

Without “by”
missing/deleted image from Google+

(Kyle bostick) #8

Without “by” cont…
missing/deleted image from Google+

(Yves BAZIN) #9

@Kyle_bostick when I wrote replace
if (setEffect == “C9”) {
FillLEDsFromPaletteColors( uint8_t colorIndex);
uint8_t brightness = 255;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 3;
}
}

by

if (setEffect == “C9”) {
FillLEDsFromPaletteColors( colorIndex);
}

that meant
delete the following lines
if (setEffect == “C9”) {
FillLEDsFromPaletteColors( uint8_t colorIndex);
uint8_t brightness = 255;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 3;
}
}

and instead write

if (setEffect == “C9”) {
FillLEDsFromPaletteColors( colorIndex);
}

so in you code you need to erase
line 552 to line 559
and of course the ‘by’
sorry if I was not clear

(Kyle bostick) #10

@Yves_BAZIN ok, I made those changes. I no longer get an error, I am confused though I do not see anywhere in the code where I create the palette. I want at least aa 6 color palette that i create/define (no sure the correct terminology)

(Yves BAZIN) #11

@Kyle_bostick
backup your code and try this

(Kyle bostick) #12

@Yves_BAZIN ok that has no errors, I think I can figure out how to delete the lines of that example I do not need to make my effect work

(Yves BAZIN) #13

@Kyle_bostick in this one you have a line that randomly change the palette line 556
ChangePalettePeriodically();
and then apply the palette
if you look at this function you’ll see how it goes from one palette to the other

(Kyle bostick) #14

That was the example I modified and tried to insert to my code, but i got errors, you fixed the errors, so i should be able to modify the code down to just the lines i need. If i get stuck, can i message you?

(Yves BAZIN) #15

@Kyle_bostick yes of course :slight_smile:
good luck :slight_smile: share the results of your coding

(Kyle bostick) #16

@Yves_BAZIN So I am super confused, I have downloaded the file you posted, and when i upload it to my board it compiles the code with no errors, uploads to the board (D1 Mini) no errors, but my board will not power on. I have tried 5 different boards! When i program a different sketch to the board it comes right back on and controls the lights. I have no idea what, or how the code would not have an error but somehow effect the board to the point it will not turn on???

(Kyle bostick) #17

@Yves_BAZIN There was a line commented out. I needed that line, so now the board is working, I have the effect almost 100% where i want it. The effect is filling in the LEDs in groups of 2, so Red, Red, White, White, Green, Green, Blue, Blue, Yellow, Yellow, Orange, Orange. I want the LEDs to be in a group 1 at a time, so Red, White, Green, Blue, etc

I would like to copy it and have a moving effect with the same colors

Here is my updated code >> https://gist.github.com/kbostick88/19c6a7eec9ec7050d12da15305465d2e

(Yves BAZIN) #18

@Kyle_bostick
good to hear. Sorry I had commented the fastled.addled to be able to compile and forgot to remove the comment.

Which one of your effects are you taking about ?

(Kyle bostick) #19

@Yves_BAZIN the “C9” effect on line 561
It turns the lights on and to the colors I am looking for, but it fills in a pattern of 2 at a time, Red, Red, White, White, Blue, Blue, Orange, Orange, Green, Green, Yellow, Yellow, instead of 1 at a time like Red, White, Blue, Orange, Green, Yellow.

Also once I fix that, If i could just copy the C9 Part and change the name to C9 Moving, I would like to make the effect move through the same colors in the c9 palette

(Yves BAZIN) #20

@Kyle_bostick
line 1202
replace

colorIndex += 8;

by

colorIndex+=16;

this should work

Yves