Guest User

BarberPoleOriginal

a guest
Oct 6th, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. void barberpole(){
  2.  
  3.   for (int rotate = 0; rotate < NUM_STRIPS; rotate++){
  4.     for( int i = 0; i < NUM_LEDS_PER_STRIP; i++) {                          
  5.       for( int strip = 0; strip < NUM_STRIPS; strip++) {
  6.  
  7.         int diag = strip+i+rotate;
  8.         diag = diag % 8;
  9.  
  10.        
  11.         switch(strip){
  12.  
  13.         case 0:
  14.           leds[diag][i] = CRGB(brightness,0,0);
  15.           break;
  16.         case 1:
  17.           leds[diag][i] = CRGB(brightness,0,0);
  18.           break;
  19.         case 2:
  20.           leds[diag][i] = CRGB(brightness,brightness,brightness);
  21.           break;
  22.         case 3:
  23.           leds[diag][i] = CRGB(brightness,brightness,brightness);
  24.           break;
  25.         case 4:
  26.           leds[diag][i] = CRGB(0,0,brightness);
  27.           break;
  28.         case 5:
  29.           leds[diag][i] = CRGB(0,0,brightness);
  30.           break;
  31.         case 6:
  32.           leds[diag][i] = CRGB(brightness,brightness,brightness);
  33.           break;
  34.         case 7:
  35.           leds[diag][i] = CRGB(brightness,brightness,brightness);
  36.           break;
  37.         }
  38.  
  39.       }
  40.     }
  41.     FastLED.show(); // display this frame
  42.     delay (200);
  43.     CheckPots();    // Added to prevent brightness setting lag.                          
  44.   }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment