Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is most likely no translated for the post!





Arduino - All LED e...
 
Share:
Notifications
Clear all

Arduino - All LED effects in one Sketch

Page 6 / 6

 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1767
Topic starter  

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.


ReplyQuote
Page 6 / 6

Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: