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!





Using Sparkle in am...
 
Share:
Notifications
Clear all

Using Sparkle in among other effects?


(@mr_bridger)
Active Member
Joined: 5 years ago
Posts: 7
Topic starter  

Hi, im a bit of a n00b at all this, but have successfully pieced together a sketch that does a few different effect, but one im having trouble with is the sparkle effect. 

i understand i need that to loop within the whole loop of the sketc as it only sees to do one sparke and then moves on. how would i add this in so it did say 25 sparkle effects and then moved on to the next and then later 25 snowsparkle?

Heres a section of the runthrough - and whole sketch attached. any help appreciated

Cheers, Ross. 

  strip.begin();

  strip.show(); // Initialize all pixels to 'off'

}

void loop() {

  // Some example procedures showing how to display to the pixels:

  colorWipe(strip.Color(255, 0, 0), 50); // Red

  colorWipe(strip.Color(255, 255, 0), 50); // Yellow

  colorWipe(strip.Color(0, 255, 0), 50); // Green

  colorWipe(strip.Color(0, 255, 255), 50); // Cyan

  colorWipe(strip.Color(0, 0, 255), 50); // Blue

  rainbow(20);

  //rainbowCycle(10);

  Strobe(0xff, 0xff, 0xff, 20, 50, 500);

  

  Sparkle(0xff, 0xff, 0xff, 0, 1000); //Need to make 25 times

  

  FadeInOut(0xCC, 0x00, 0xFF); //PURPLE

  FadeInOut(0xFF, 0xFF, 0x00); //YELLOW

  FadeInOut(0xCC, 0x00, 0xFF); //PURPLE

  FadeInOut(0xFF, 0xFF, 0x00); //YELLOW

  SnowSparkle(0x10, 0x10, 0x10, 20, random(100,1000)); //Need to make 25 times

  

}

//End Features


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1758
 

Hi Mr_Bridger!

Welcome to the forum!
As for your Sparkle question (for who is reading this: original Sparkle code can be found here);

You can do a loop like so:

for(int i=0; i<25; i++) {
Sparkle(0xff, 0xff, 0xff, 0, 1000); //Need to make 25 times
}

This will call the Sparkle function 25 times. 
Replace your original "Sparkle(0xff, 0xff, 0xff, 0, 1000); //Need to make 25 times" line with these 3 ...
Change the number 25 to any number you'd like.

Hope this is what you're looking for ...

p.s. If you're interested in more info on how to use a for-loop, see Part 5 of the little Arduino Programming Course I wrote.  


ReplyQuote
(@mr_bridger)
Active Member
Joined: 5 years ago
Posts: 7
Topic starter  

Oh my, so simple! lol. i was trying to put in in the actual feature lower in the sketch. Many thanks for your help Hans! and a great site.  

i will certainly check out your programming course, will no doubt give me many more ideas and stop me asking silly question. ;-)


ReplyQuote
 Hans
(@hans)
Noble Member Admin
Joined: 8 years ago
Posts: 1758
 

No problem - glad I could help 

Enjoy playing with the LED strips (fun stuff isn't it?) .... 


ReplyQuote

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: