allanGEE

IN PROGRESS FastLED Comet Effect

Nov 18th, 2016
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. // **********************************
  2. // **** THIS IS NOT WORKING YET ****
  3. // **********************************
  4. //
  5. //
  6. //
  7. // This sketch is specifically for my exterior LED lights on my house
  8. // I started with MirroringSample - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples
  9. // I have 4 strings of LEDs that will, for the most part, mirror each other
  10.  
  11. // **********************
  12. // * *
  13. // * INITIAL PARAMETERS *
  14. // * *
  15. // **********************
  16.  
  17. #include "FastLED.h"
  18. #define NUM_LEDS_PER_STRIP 100 // I am using the longest strip for the amount of LEDS since
  19. // I want all strips to start at the same time every time
  20. CRGB leds[NUM_LEDS_PER_STRIP];
  21. // **********************
  22. // * *
  23. // * VOID SETUP *
  24. // * *
  25. // **********************
  26. void setup() {
  27.  
  28. // ***** SETTING UP THE MIRRORING *****
  29. // For mirroring strips, all the "special" stuff happens just in setup.
  30. // Need to addLeds multiple times, once for each strip
  31. FastLED.addLeds<WS2812B, 8, GRB>(leds, NUM_LEDS_PER_STRIP); // ********** I added the RGB ***********
  32. // above says there # LEDS in the strip as per INITIAL PARAMETERS **** noting in case it causes problems *******
  33. // The 8 is the data pin I want for this strip
  34. FastLED.addLeds<WS2812B, 9, GRB>(leds, NUM_LEDS_PER_STRIP);
  35. // above says there # LEDS in the strip as per INITIAL PARAMETERS
  36. // The 9 is the data pin I want for this strip
  37. FastLED.addLeds<WS2812B, 10, GRB>(leds, NUM_LEDS_PER_STRIP);
  38. // above says there # LEDS in the strip as per INITIAL PARAMETERS
  39. // The 10 is the data pin I want for this strip
  40. FastLED.addLeds<WS2812B, 11, GRB>(leds, NUM_LEDS_PER_STRIP);
  41. // above says there # LEDS in the strip as per INITIAL PARAMETERS
  42. // The 11 is the data pin I want for this strip
  43. // ***** SETTING THE DEFAULT BRIGHTNESS *****
  44.  
  45. FastLED.setBrightness(63); // about one-quarter brightness
  46.  
  47. // ***** ADDING A DELAY BEFORE THINGS START *****
  48. delay(5000); // 1000 = 1 second
  49. //
  50. } // ***** THE END OF VOID SETUP *****
  51. //
  52. //
  53. // * VOID LOOP *
  54. //
  55. //
  56. void loop()
  57. {
  58. //
  59. // ***** FILLING THE STRIPS WITH RED *****
  60. //
  61. for(int i = 0; i < NUM_LEDS_PER_STRIP; i++)
  62. {
  63. //
  64. leds[i] = CHSV( 0, 255, 255);
  65. leds[i-1] = CHSV(0,255,200);
  66. leds[i-2] = CHSV(0,255,175);
  67. leds[i-3] = CHSV(0,255,125);
  68. leds[i-4] = CHSV(0,255,75);
  69. leds[i-5] = CHSV(0,255,25);
  70. leds[i-6] = CHSV(0,255,10);
  71. leds[i-7] = CHSV(0,255,10);
  72. leds[i-8] = CHSV(0,255,10);
  73. //
  74. delay(3); // Determines speed of comet
  75. //
  76. FastLED.show(); // tells FastLED to display what you've asked for above
  77. //
  78. }
  79. //
  80. //
  81. } // This designates the end of the void loop so the program
  82. // will now go to the start of loop again.
Advertisement
Add Comment
Please, Sign In to add comment