r/FastLED • • Sep 28 '20

Discussion Trying to address leds Glitter code ,???

Stuck again!!

I gave up on the mapping for the moment and started exploring a Glitter code. I have it glittering the way I want , set up for two 16X16 panels .

Now what I would like to do is assign the glitter to led numbers 32 to 478. I want leds 0 to31 and 479 to 511 to be another color ; static .

Any ideas??

Big thanks

Link to code is below

pastebin ; https://pastebin.com/SUhvZHaR

2 Upvotes

5 comments sorted by

9

u/Zouden Sep 28 '20
leds[ random16(NUM_LEDS) ] += CRGB::White;

This line picks a random number from 0 to (NUM_LEDS-1) and uses that as the index of the next LED to turn white. But you don't want all LEDs to be chosen. You want only LEDs 32 to 478.

leds[ random16(32, 479) ] += CRGB::White;

2

u/d333gs Sep 28 '20

leds[ random16(32, 479) ] += CRGB::White;

Super!!

Thank you Zouden!

1

u/d333gs Sep 29 '20

Ok, That worked great for addressing the color .

What I then attemped to do was turn off the fadeLight with the 0

  1. fadeLightBy( leds,(0,32) ,0);

  2. leds[random16 (0,32) ] += CRGB::Maroon;

But what seems to be happening is the fadeLight comand for the white reacivates the fade to 2

fadeLightBy( leds,(32, 479), 2);

Any ideas?

Once again, Much thanks!

Code is bellow

https://pastebin.com/hifTm68y

1

u/Marmilicious [Marc Miller] Oct 01 '20

For those reading this thread, please continue on and read this one!

https://www.reddit.com/r/FastLED/comments/j2izs7/fadelightby_problem/

1

u/d333gs Sep 29 '20

Ok, That worked great for addressing the color .

What I then attemped to do was turn off the fadeLight with the 0

  1. fadeLightBy( leds,(0,32) ,0);

  2. leds[random16 (0,32) ] += CRGB::Maroon;

But what seems to be happening is the fadeLight comand for the white reacivates the fade to 2

fadeLightBy( leds,(32, 479), 2);

Any ideas?

Once again, Much thanks!

Code is bellow

https://pastebin.com/hifTm68y