marmil

DemoReel100 patterns

Jun 12th, 2017 (edited)
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. // Patterns that can be added to FastLED's DemoReel100 example
  2.  
  3. void confetti_GB()
  4. {
  5.   // random colored speckles, Green and Blue hues only
  6.   // Green = 96, Blue = 160
  7.   uint8_t p = 25;  // What percentage of the time to make speckles.  [Range 0-100]
  8.  
  9.   fadeToBlackBy( leds, NUM_LEDS, 10);
  10.   if (random8(100) < p) {
  11.     int pos = random16(NUM_LEDS);
  12.     uint8_t hue = random8(2);  // randomly chooses a 0 or 1
  13.     if (hue == 0) {
  14.       hue = random8(92,111);  // pick a hue somewhere in the green zone
  15.     } else {
  16.       hue = random8(156,165);  // pick a hue somewhere in the blue zone
  17.     }
  18.     leds[pos] += CHSV( hue, random8(200,240), 255);
  19.   }
  20. }//end confetti_GB
Add Comment
Please, Sign In to add comment