SHARE
TWEET

rainbowCyclePlayer1

ChipSkylarkk Jun 20th, 2013 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void rainbowCyclePlayer1(uint8_t wait)
  2. {
  3.   int m = 32;
  4.   uint16_t k, j;
  5.  
  6.   //Turns off player 1 LEDs
  7.   digitalWrite(latch2, LOW);
  8.   shiftOut(data2, clock2, MSBFIRST, 255);  
  9.   digitalWrite(latch2, HIGH);
  10.    
  11.   for (j=0; j < 384 * 3; j++) {     // 5 cycles of all 384 colors in the wheel
  12.     for (k=0; k < strip.numPixels(); k++) {
  13.       // tricky math! we use each pixel as a fraction of the full 384-color wheel
  14.       // (thats the i / strip.numPixels() part)
  15.       // Then add in j which makes the colors go around per pixel
  16.       // the % 384 is to make the wheel cycle around
  17.       strip.setPixelColor(k, Wheel( ((k * 384 / strip.numPixels()) + j) % 384) );
  18.     }  
  19.     strip.show();   // write all the pixels out
  20.     delay(wait);
  21.   }
  22.   for(m; m >= 0; m--)
  23.   {
  24.   strip.setPixelColor(m, 0);
  25.   strip.show();
  26.   }
  27.   //Turn on player1 LEDs
  28.   digitalWrite(latch2, LOW);
  29.   shiftOut(data2, clock2, MSBFIRST, 0);  
  30.   digitalWrite(latch2, HIGH);
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top