Page 1 of 1

Using Sparkle in among other effects?

Using Sparkle in among other effects?

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.
Examples: "MacOS X - Your question", "MS Word - Your Tip or Trick".

Please note that switching to another language when reading a post will not work!
Posts will not have a translated counterpart.




RSS Feed

Home Forums Hardware Arduino Using Sparkle in among other effects?

This topic contains 3 replies, has 2 voices, and was last updated by  hans 2 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • 6292

    mr_bridger
    Participant

    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

    Attachments:
    6295

    hans
    Keymaster

    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.  

    6297

    mr_bridger
    Participant

    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. ;-)

    6299

    hans
    Keymaster

    No problem – glad I could help 

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

Viewing 4 posts - 1 through 4 (of 4 total)



You must be logged in to reply to this topic.