allanGEE

FastLED Candy Cane Animated Variable Speed TEST 2016_11_30

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