Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
1,287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. #include <avr/pgmspace.h> //Needed to store stuff in Flash using PROGMEM
  2. #include <EEPROM.h> //Needed to store variables in memory to persist after power off.
  3. #include <FastLED.h> //Fastled library to control the LEDs
  4.  
  5. #define MAX_BRIGHT 40
  6.  
  7. #define LED_PIN 3
  8. #define LED_TYPE WS2812B
  9. #define COLOR_ORDER GRB
  10.  
  11. #define NUM_LEDS 105
  12. #define NUM_LEDS_R1_MAX 35
  13. #define NUM_LEDS_R2_MAX 70
  14. #define NUM_LEDS_R3_MAX 105
  15.  
  16. // Define the array of leds
  17. CRGB leds[NUM_LEDS];
  18.  
  19. /* - - Stored Text - - */
  20. int thots_r1[] = {18,17,16,14,12,10,9,8,6,5,4,1,0};
  21. int thots_r2[] = {36,40,43,45,47,48,49,52};
  22. int thots_r3[] = {87,84,82,80,79,78,75,72,71};
  23.  
  24. int thot_len_r1 = sizeof(thots_r1) / sizeof(thots_r1[0]);
  25. int thot_len_r2 = sizeof(thots_r2) / sizeof(thots_r2[0]);
  26. int thot_len_r3 = sizeof(thots_r3) / sizeof(thots_r3[0]);
  27.  
  28. int sym_and[3][3] =
  29. {
  30. {0,1,0},
  31. {1,1,1},
  32. {0,1,0},
  33. };
  34.  
  35. int prayers[] =
  36. {
  37. 1,1,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  38. 0,1,0,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  39. 0,1,1,0,0,1,0,0,1,1,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  40. };
  41.  
  42. int prayers_r1[35]= {1,1,0,0,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  43. int prayers_r2[35]= {0,1,0,0,0,1,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  44. int prayers_r3[35]= {0,1,1,0,0,1,0,0,1,1,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  45.  
  46. void setup() {
  47. // put your setup code here, to run once:
  48. //Serial.begin(115200);
  49. delay(1500); //Startup power delay. 1.5 seconds.
  50. FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  51. FastLED.setMaxPowerInVoltsAndMilliamps(5,800);
  52. //attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), changeEffect, CHANGE); // interupt for button press.
  53. FastLED.setBrightness(MAX_BRIGHT);
  54. fill_solid(leds, NUM_LEDS, CRGB::Black);
  55. FastLED.show();
  56. }
  57.  
  58. void loop() {
  59. RunningLights();
  60. //text_scroll();
  61. }
  62.  
  63. void text_scroll() {
  64.  
  65. for( int j=0; j < 10; j++ ) //Do 4 cycles of chasing lights.
  66. {
  67. for(int q=0; q < 19; q++) //Size of the moving bars
  68. {
  69. for(int i=-16; i < NUM_LEDS_R1_MAX; i++) //Should be NUM_LEDS_
  70. {
  71. if(prayers_r1[] == 1){
  72. leds[i+q] = CRGB::Blue;
  73. }
  74. }
  75. // for(int i=0; i < 15; i=i+bar_size+1)
  76. // {
  77. // leds[i+q] = CRGB::Black;
  78. // }
  79. FastLED.show();
  80. FastLED.delay(WaveDelay);
  81. }
  82. }
  83.  
  84. void RunningLights() {
  85.  
  86. int x = 0;
  87.  
  88. //FastLED.clear();
  89. for(int i = -16; i < NUM_LEDS_R1_MAX; i++) {
  90.  
  91. if(prayers_r1[x] == 1 && i >= 1 )
  92. {
  93. leds[i] = CRGB::Blue;
  94. x++;
  95. }
  96.  
  97. //x++;
  98. }
  99.  
  100. FastLED.show();
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement