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!



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

[Solved] Using Sparkle in among other effects?

4 Posts
2 Users
0 Likes
1,737 Views
(@mr_bridger)
Active Member
Joined: 8 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)
Famed Member Admin
Joined: 11 years ago
Posts: 2675
 

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: 8 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)
Famed Member Admin
Joined: 11 years ago
Posts: 2675
 

No problem - glad I could help 

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


   
ReplyQuote
Share: