allanGEE

FastLED Every_N-Millseconds Test

Nov 25th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. // *************************************
  2. // *************************************
  3. // **** TRYING TO FIGURE OUT ****
  4. // **** THE EVERY_N_MILLISECONDS ****
  5. // **** FUNCTION ****
  6. // *************************************
  7. // *************************************
  8. //
  9. //
  10. // *************************************
  11. // *** ***
  12. // *** UNTESTED ***
  13. // *** ***
  14. // *************************************
  15. //
  16. //
  17. //
  18. #include "FastLED.h"
  19. //
  20. #define DATA_PIN 8
  21. //
  22. //#define CLK_PIN 4
  23. //
  24. #define NUM_LEDS 100
  25. //
  26. CRGB leds[NUM_LEDS];
  27. // the above creates an LED array to hold
  28. // the values for each led in your strip
  29. // Whatever THAT means :)
  30. //
  31. // ****************
  32. // ****************
  33. // ** VOID SETUP **
  34. // ****************
  35. // ****************
  36. //
  37. void setup()
  38. // void setup gets everything ready for what will run in the void loop.
  39. {
  40. //
  41. delay(3000); // 3 second delay for recovery
  42. //
  43. FastLED.setBrightness(96);
  44. //
  45. FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  46. //
  47. // FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  48. // The above is another common type of strip
  49. // You would comment the WS2812B and uncomment the Neopixel to use it.
  50. //
  51. }
  52. //
  53. // ***************
  54. // ***************
  55. // ** VOID LOOP **
  56. // ***************
  57. // ***************
  58. //
  59. void loop()
  60. //
  61. {
  62. //
  63. //
  64. EVERY_N_MILLISECONDS(5000) {
  65. leds[0] = CHSV( 0, 255, 255);
  66. FastLED.show();
  67. delay(1000);
  68. leds[0] = CHSV( 0, 255, 0);
  69. FastLED.show();
  70. }
  71. //
  72. //
  73. EVERY_N_MILLISECONDS(2500) {
  74. leds[2] = CHSV( 96, 255, 255);
  75. FastLED.show();
  76. delay(1000);
  77. leds[2] = CHSV( 96, 255, 0);
  78. FastLED.show();
  79. }
  80. //
  81. //
  82. EVERY_N_MILLISECONDS(2500) {
  83. leds[4] = CHSV( 160, 255, 255);
  84. leds[4].fadeToBlackBy(50);
  85. FastLED.show();
  86. }
  87. //
  88. //************************************
  89. EVERY_N_MILLISECONDS(5000) {// *
  90. leds[6] = CHSV( 0, 255, 255);// *
  91. FastLED.show();// *
  92. }// *
  93. EVERY_N_MILLISECONDS(5000+500) {// *
  94. leds[6] = CHSV( 0, 255, 0);// *
  95. FastLED.show();// *
  96. }//***********************************
  97. //
  98. //
  99. }
Advertisement
Add Comment
Please, Sign In to add comment