Guest User

Fixed scroll

a guest
Jul 20th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. byte wipeOrder[NUM_STRIPS] = {0,4,1,3,2}; // order to load strips in. used to stop it from looking like it wipes down every refresh
  2.  
  3.  
  4.   void scroll() {
  5.     for (int i=0; i<NUM_STRIPS; i++) {
  6.         shift(leds, message[wipeOrder[i]]);
  7.         FastLED[wipeOrder[i]].showLeds();
  8.     }
  9.     delay(1000/FPS);
  10.   }
  11.  
  12.   void shift(CRGB* arr, byte* msg) {
  13.     for (int j=0; j<NUM_LEDS; j++) { // fill LEDs based on message, using counter as an offset
  14.           arr[j] = msg[(counter + j) % min(realLength + 5, MSG_LENGTH)] == 0 ? CRGB(0,0,0) : on;
  15.         }
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment