allanGEE

FastLED Candy Cane Animated 2016_11_30

Nov 30th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. // ****************************
  2. // ****************************
  3. // **** WORKS ***
  4. // ****************************
  5. // ****************************
  6. //
  7. //
  8. // ****************************
  9. // ****************************
  10. // **** CANDY CANE COLORS ***
  11. // *** ANIMATED ***
  12. // ****************************
  13. // ****************************
  14. //
  15. #include "FastLED.h"
  16. //
  17. #define DATA_PIN 8
  18. //
  19. //#define CLK_PIN 4
  20. //
  21. #define NUM_LEDS 100
  22. //
  23. CRGB leds[NUM_LEDS];
  24. // the above creates an LED array to hold
  25. // the values for each led in your strip
  26. // Whatever THAT means :)
  27. //
  28. // ****************
  29. // ****************
  30. // ** VOID SETUP **
  31. // ****************
  32. // ****************
  33. //
  34. void setup()
  35. // void setup gets everything ready for what will run in the void loop.
  36. {
  37. //
  38. delay(3000); // 3 second delay for recovery
  39. //
  40. FastLED.setBrightness(96);
  41. //
  42. FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  43. //
  44. // FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  45. // The above is another common type of strip
  46. // You would comment the WS2812B and uncomment the Neopixel to use it.
  47. //
  48. }
  49. //
  50. // ***************
  51. // ***************
  52. // ** VOID LOOP **
  53. // ***************
  54. // ***************
  55. //
  56. void loop()
  57. //
  58. {
  59. int caneDelay = 250;
  60. //
  61. fill_solid(leds, NUM_LEDS, CHSV(0,255,255) ); // fill entire strip will Red
  62.  
  63. for(int i = 0; i < NUM_LEDS; i+=6) //chooses every 5th LED starting at 0
  64. {
  65. leds[i] = CHSV(0, 0, 200); //fill every 5th LED with White, with the brightness turned down a little
  66. }
  67. for(int i = 3; i < NUM_LEDS; i+=6) //chooses every 5th LED BUT starting at 1
  68. {
  69. leds[i] = CHSV(96, 255, 255); //fill every 5th LED with Green
  70. }
  71. FastLED.show();
  72. delay(caneDelay);
  73.  
  74.  
  75. fill_solid(leds, NUM_LEDS, CHSV(0,255,255) ); // fill entire strip will Red
  76.  
  77. for(int i = 1; i < NUM_LEDS; i+=6) //chooses every 5th LED starting at 0
  78. {
  79. leds[i] = CHSV(0, 0, 200); //fill every 5th LED with White, with the brightness turned down a little
  80. }
  81. for(int i = 4; i < NUM_LEDS; i+=6) //chooses every 5th LED BUT starting at 1
  82. {
  83. leds[i] = CHSV(96, 255, 255); //fill every 5th LED with Green
  84. }
  85. FastLED.show();
  86. delay(caneDelay);
  87.  
  88.  
  89. fill_solid(leds, NUM_LEDS, CHSV(0,255,255) ); // fill entire strip will Red
  90.  
  91. for(int i = 2; i < NUM_LEDS; i+=6) //chooses every 5th LED starting at 0
  92. {
  93. leds[i] = CHSV(0, 0, 200); //fill every 5th LED with White, with the brightness turned down a little
  94. }
  95. for(int i = 5; i < NUM_LEDS; i+=6) //chooses every 5th LED BUT starting at 1
  96. {
  97. leds[i] = CHSV(96, 255, 255); //fill every 5th LED with Green
  98. }
  99. FastLED.show();
  100. delay(caneDelay);
  101.  
  102.  
  103. fill_solid(leds, NUM_LEDS, CHSV(0,255,255) ); // fill entire strip will Red
  104.  
  105. for(int i = 3; i < NUM_LEDS; i+=6) //chooses every 5th LED starting at 0
  106. {
  107. leds[i] = CHSV(0, 0, 200); //fill every 5th LED with White, with the brightness turned down a little
  108. }
  109. for(int i = 0; i < NUM_LEDS; i+=6) //chooses every 5th LED BUT starting at 1
  110. {
  111. leds[i] = CHSV(96, 255, 255); //fill every 5th LED with Green
  112. }
  113. FastLED.show();
  114. delay(caneDelay);
  115.  
  116.  
  117. fill_solid(leds, NUM_LEDS, CHSV(0,255,255) ); // fill entire strip will Red
  118.  
  119. for(int i = 4; i < NUM_LEDS; i+=6) //chooses every 5th LED starting at 0
  120. {
  121. leds[i] = CHSV(0, 0, 200); //fill every 5th LED with White, with the brightness turned down a little
  122. }
  123. for(int i = 1; i < NUM_LEDS; i+=6) //chooses every 5th LED BUT starting at 1
  124. {
  125. leds[i] = CHSV(96, 255, 255); //fill every 5th LED with Green
  126. }
  127. FastLED.show();
  128. delay(caneDelay);
  129.  
  130.  
  131. fill_solid(leds, NUM_LEDS, CHSV(0,255,255) ); // fill entire strip will Red
  132.  
  133. for(int i = 5; i < NUM_LEDS; i+=6) //chooses every 5th LED starting at 0
  134. {
  135. leds[i] = CHSV(0, 0, 200); //fill every 5th LED with White, with the brightness turned down a little
  136. }
  137. for(int i = 2; i < NUM_LEDS; i+=6) //chooses every 5th LED BUT starting at 1
  138. {
  139. leds[i] = CHSV(96, 255, 255); //fill every 5th LED with Green
  140. }
  141. FastLED.show();
  142. delay(caneDelay);
  143.  
  144. }
  145. //
Advertisement
Add Comment
Please, Sign In to add comment