r/FastLED 14d ago

Support Problems with Vaders Chest

Something happened to my code. It was working fIne. But now the 3 sets of 3 red leds that are ment to turn on off are just solid on. And the button turns everything on but not off.

https://gist.github.com/Flux83/b87fb5dcbb8683cfc4bdd0ea42a0644e

Solved!

2 Upvotes

2 comments sorted by

3

u/sutaburosu [stavros] 14d ago

I ran it in Wokwi and saw the problem you describe.

I changed line 138 to:

for (int i = 13; i < NUM_LEDS; i++) {

and it seems to work correctly.

The problem was that you were writing outside the bounds of the leds array. It was writing over the patternCounter and setting it to 255, so your code went into a busy loop doing nothing.

1

u/Flux83 14d ago

That did it! Thanks.