Saturday, May 9, 2020

Pixel LED

2020,wesak Thorana using Arduino and Pixel LED.

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
 #include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN        6 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 100 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter -- see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 1 // Time (in milliseconds) to pause between pixels
#define DELAYVAL1 100

void setup() {
  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
 
}

void loop() {
         wipe2();
         wipe3();
         wipeOne();
       // wipeRight();
        rainbow(20);             // Flowing rainbow cycle along the whole strip
        theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
        upDown1();
        upDown2();
        theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
  //pixels.clear(); // Set all pixel colors to 'off'
}

// ======Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait) {
  // Hue of first pixel runs 5 complete loops through the color wheel.
  // Color wheel has a range of 65536 but it's OK if we roll over, so
  // just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
  // means we'll make 5*65536/256 = 1280 passes through this outer loop:
  for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
    for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
      // Offset pixel hue by an amount to make one full revolution of the
      // color wheel (range of 65536) along the length of the strip
      // (strip.numPixels() steps):
      int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
      // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
      // optionally add saturation and value (brightness) (each 0 to 255).
      // Here we're using just the single-argument hue variant. The result
      // is passed through strip.gamma32() to provide 'truer' colors
      // before assigning to each pixel:
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show(); // Update strip with new contents
    delay(wait);  // Pause for a moment
  }
}

//================================================================================
void rainbow2(int wait) {
  // Hue of first pixel runs 5 complete loops through the color wheel.
  // Color wheel has a range of 65536 but it's OK if we roll over, so
  // just count from 0 to 5*65536. Adding 256 to firstPixelHue each time
  // means we'll make 5*65536/256 = 1280 passes through this outer loop:
  for(long firstPixelHue = 5*65536; firstPixelHue >0; firstPixelHue -= 256) {
    for(int i=strip.numPixels(); i>0; i--) { // For each pixel in strip...
      // Offset pixel hue by an amount to make one full revolution of the
      // color wheel (range of 65536) along the length of the strip
      // (strip.numPixels() steps):
      int pixelHue = firstPixelHue - (i * 65536L / strip.numPixels());
      // strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
      // optionally add saturation and value (brightness) (each 0 to 255).
      // Here we're using just the single-argument hue variant. The result
      // is passed through strip.gamma32() to provide 'truer' colors
      // before assigning to each pixel:
      strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
    }
    strip.show(); // Update strip with new contents
    delay(wait);  // Pause for a moment
  }
}

// ==========upDown1 begin hear====================================================

void upDown1(){
  for(int n=0;n<5;n++){
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(0, 0, 150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(30,50, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(90,150, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(0, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(50,50,50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(150,150,50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(20, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(60, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
  }
    for(int n=0;n<5;n++){
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(0, 0, 50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(90,150, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(30,50, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(0, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(150,150,150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(50,50,50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(60, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                pixels.setPixelColor(i, pixels.Color(20, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          }
  }

 // =======Rainbow-enhanced theater marquee. Pass delay time (in ms) between frames.
void theaterChaseRainbow(int wait) {
  int firstPixelHue = 0;     // First pixel starts at red (hue 0)
  for(int a=0; a<30; a++) {  // Repeat 30 times...
    for(int b=0; b<3; b++) { //  'b' counts from 0 to 2...
      strip.clear();         //   Set all pixels in RAM to 0 (off)
      // 'c' counts up from 'b' to end of strip in increments of 3...
      for(int c=b; c<strip.numPixels(); c += 3) {
        // hue of pixel 'c' is offset by an amount to make one full
        // revolution of the color wheel (range 65536) along the length
        // of the strip (strip.numPixels() steps):
        int      hue   = firstPixelHue + c * 65536L / strip.numPixels();
        uint32_t color = strip.gamma32(strip.ColorHSV(hue)); // hue -> RGB
        strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
      }
      strip.show();                // Update strip with new contents
      delay(wait);                 // Pause for a moment
      firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
    }
  }
}

void wipeRight() {

//                for(int i=0; i<22; i++) { // For each pixel...
//                if(i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8)
//                  continue;
//                int y = i;
//                pixels.setPixelColor(y, pixels.Color(0, 0, 50));
//                pixels.show();   // Send the updated pixel colors to the hardware.
//                delay(DELAYVAL); // Pause before next pass through loop
//                } 
 
  for(int n=0;n<3;n++){
    for(int r = 1; r<=13; r++){
          for(int i=9; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }        

          for(int i =0; i<=7; i++) {
            pixels.setPixelColor(r, pixels.Color(0, 10, 0));
           
          }
         
                
//          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
//                pixels.setPixelColor(i, pixels.Color(0, 0, 100));
//                pixels.show();   // Send the updated pixel colors to the hardware.
//                delay(DELAYVAL); // Pause before next pass through loop
//                }
    }
  }
}

//=========================upDown2 begin hear =======================================
void upDown2(){

  for(int n=0;n<3;n++){
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }         
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 100));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 100));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
               
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(30,50, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(90,150, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(200,255, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(90,150, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(30,50, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
     
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 100,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 100,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
    
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(50,50,50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(150,150,150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(255,255,255));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(150,150,150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(50,50,50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
               
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(20, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(60, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(180, 255,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(60, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(20, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         }
         for(int n=0;n<3;n++){
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 255));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 0, 50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
        
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(30,50, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }         
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(90,150, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }         
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(200,255, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(90,150, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(30,50, 0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }


         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }         
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }               
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 255,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(0, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(50,50,50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }        
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(150,150,150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }               
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(255,255,255));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(150,150,150));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(50,50,50));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(20, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }        
         for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(60, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }               
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(180, 255,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(60, 150,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          for(int i=NUMPIXELS; i>0; i--) { // For each pixel...
                pixels.setPixelColor(i, pixels.Color(20, 50,0));
                pixels.show();   // Send the updated pixel colors to the hardware.
                delay(DELAYVAL); // Pause before next pass through loop
                }
          }
  }

  void wipeOne(){
    for(int n=0; n<4; n++){
    for(int t=25; t<250; t+=40){
              for(int i=0; i<9; i++) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
              for(int j=9; j<22; j++){
                      pixels.setPixelColor(j, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop               
                      }

              for(int k=22; k<35; k++){
                      pixels.setPixelColor(k, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                        }
              for(int l=35; l<48; l++){
                      pixels.setPixelColor(l, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
              for(int m=48; m<61; m++){
                      pixels.setPixelColor(m, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
              for(int n=61; n<74; n++){
                      pixels.setPixelColor(n, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
               for(int o=74; o<87; o++){
                      pixels.setPixelColor(o, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }            
                for(int p=87; p<100; p++){
                      pixels.setPixelColor(p, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     } 
                      delay(DELAYVAL); // Pause before next pass through loop 
            }    
    for(int t=255; t>25; t-=40){
              for(int i=0; i<9; i++) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
              for(int j=9; j<22; j++){
                      pixels.setPixelColor(j, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop               
                      }

              for(int k=22; k<35; k++){
                      pixels.setPixelColor(k, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                        }
              for(int l=35; l<48; l++){
                      pixels.setPixelColor(l, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
              for(int m=48; m<61; m++){
                      pixels.setPixelColor(m, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
              for(int n=61; n<74; n++){
                      pixels.setPixelColor(n, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }
               for(int o=74; o<87; o++){
                      pixels.setPixelColor(o, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     }            
                for(int p=87; p<100; p++){
                      pixels.setPixelColor(p, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
                     } 
                      delay(DELAYVAL); // Pause before next pass through loop          
               }                            
    }}

    void wipe2(){
      //int t =50;

     for (int t=30; t<255; t+=45) {  
      for(int n=0; n<9; n++){
                      pixels.setPixelColor(n, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
      }

                     


              for(int i=9; i<100; i+=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=21; j<100; j+=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }

              for(int i=10; i<100; i+=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=20; j<100; j+=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }     

              for(int i=11; i<100; i+=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=19; j<100; j+=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }     
            for(int i=12; i<100; i+=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(0, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
            for(int j=18; j<100; j+=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(0, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }   
            for(int i=13; i<100; i+=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=17; j<100; j+=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 } 
            for(int i=14; i<100; i+=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=16; j<100; j+=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }
             for(int i=15; i<100; i+=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=15; j<100; j+=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }      
              }                                               
      }    
 void wipe3(){
      //int t =50;

     for (int t=255; t>25; t-=30) {  
      for(int n=0; n<9; n++){
                      pixels.setPixelColor(n, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
      }

                     


              for(int i=100; i>8; i-=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=86; j>8; j-=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, 0,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }

              for(int i=98; i>9; i-=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=88; j>9; j-=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }     

              for(int i=97; i>9; i-=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=89; j>9; j-=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }  
                   
            for(int i=96; i>9; i-=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(0, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
            for(int j=90; j>9; j-=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(0, t,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }

                   
            for(int i=95; i>9; i-=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=91; j>9; j-=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(0, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }
                
            for(int i=94; i>9; i-=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(t, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=92; j>9; j-=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(t, 0,t));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }
                
             for(int i=93; i>9; i-=13) { // For each pixel...
                      pixels.setPixelColor(i, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loop
              for(int j=93; j>9; j-=13) { // For each pixel...
                      pixels.setPixelColor(j, pixels.Color(0, t,0));
                      pixels.show();   // Send the updated pixel colors to the hardware.
                      delay(DELAYVAL); // Pause before next pass through loo
                     }
                 }      
              }                                               
      }    

Search This Blog