Advertisement
ChipSkylarkk

rainbowCyclePlayer2

Jun 20th, 2013
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. void rainbowCyclePlayer2(uint8_t wait)
  2. {
  3.   int m = 0;
  4.   uint16_t k, j;
  5.  
  6.    //Turns off player 2 LEDs
  7.    digitalWrite(latch3, LOW);
  8.    shiftOut(data3, clock3, MSBFIRST, 255);  
  9.    digitalWrite(latch3, HIGH);
  10.    
  11.    for (j=384 * 3; j > 0; 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=0; m < 32; m++)
  23.   {
  24.   strip.setPixelColor(m, 0);
  25.   strip.show();
  26.   }
  27.   //Turn on player2 LEDs
  28.   digitalWrite(latch3, LOW);
  29.   shiftOut(data3, clock3, MSBFIRST, 0);  
  30.   digitalWrite(latch3, HIGH);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement