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 no translation for that post!



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

[Solved] Arduino - All LED effects in one Sketch

76 Posts
22 Users
0 Likes
18.4 K Views
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2691
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
Share: