Quantcast
Channel: Tweaking4All.com » All Posts
Viewing all articles
Browse latest Browse all 142

Reply To: Arduino – All LED effects in one Sketch

$
0
0

I see why the SnowSparkle behaves differently now:

So normally, a loop() is repeated over and over again. SnowSparkle uses this to set one sparkle each time.
So when loop() calls SnowSparkle again, and again, the color will be different each time it is called.

One way to resole this is by setting the SnowSparkle call in some sorts of loop (in the “loop()”).

For example:

case 9  : {
               byte red = random(255);
               byte green = random(255);
               byte blue = random(255);

               while(true) {
                SnowSparkle(red,green,blue, 20, random(100,1000));
               }
               break;
           }

Something like this should resolve this.
The button press will interrupt this loop.

The original idea was to keep effects as short as possible, so interruption would have been easier.
This is no longer relevant, since the button interrupt stops it anyway.


Viewing all articles
Browse latest Browse all 142

Trending Articles