How to make colorwipe to go faster

I know ws2812B goes at a specific bitrate,but How can I make the colorwipe (1 and 2) do go faster? like to turn on leds by groups of two or three leds

// DIGITAL MOTION SENSING STAIR LIGHTS
// Imran O Mumtaz
// Summer 2013
// Sources: ADAFRUIT LIBRARY, ARDUINO EXAMPLE CODE, ARDUINO FORUMS + (USER: JamesHayek) for some of the cool effects!
// Nested If statement suggested by Jessica Milne (CS 375)


// This system utilizes an Atmel Atmega 328p MCU along with 2 PIR (Pyroelectric infrared) Sensors (HC-SR501) and a Digital RGB LED strip (WS2811).
// One sensor placed at the bottom of the stairs (or where ever) and one at the top. Each sensor triggers a different animation (walking up or walking down) along with a shut down warning animation.
// Just modify the function calls in the void loop() and the actual functins towards the bottom area to change the animations, color, etc. colorWipe for example. 
// The four parameters it takes are the RGB pixels followed by the speed at which you wish to run the animations. 0, 0, 0 would mean the LEDS are off and 255, 255, 255 means that they are all white/full brightness.




// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip)

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel strip = Adafruit_NeoPixel(666, 6, NEO_GRB + NEO_KHZ800);


const int RELAY_PIN = 2;
int motionPin = 8;                                                                                 // PIR Input pin 8, UPSTAIRS
int motionPin2 = 7;                                                                                // PIR 2 Input pin 7, DOWNSTAIRS
int senseMotion = 0;                                                                               // variable to hold current state of motion detector
int senseMotion2 = 0;                                                                              // 2nd variable for 2nd sensor




void setup() {
   pinMode(RELAY_PIN, OUTPUT);
  pinMode(motionPin, INPUT);                                                                      //PIRs declared as inputs
  pinMode(motionPin2, INPUT);
   digitalWrite(RELAY_PIN, HIGH);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  rainbow (30000);
  rainbowCycle (30000);
  strip.show();
}

void loop() {
  
    senseMotion = digitalRead (motionPin);                                                        //set variables equal to what our sensors are reading (on or off)
    senseMotion2 = digitalRead (motionPin2);
    
      if (senseMotion == HIGH || senseMotion2 == HIGH) {                                          // Testing both sensors at same time, if high, go to apropriate line.
          
          if (senseMotion2 == HIGH) {                                                               // If Upstairs motion sensor is triggered...
          digitalWrite(RELAY_PIN, HIGH);
          colorWipe (strip.Color (30, 50, 255), 0);                                             // White/blue color sweep going up stairs (Towards the arrow on the strip)
          strip.show();                                                                           // This being enabled or not, doesnt seem to make a difference. NVM it looks like its more responsive when trying to activate the PIRs one after another
          delay (10000);                                                                          // Wait so someone can get to the bottom or top of stairs, will remove this when 2nd sensor is implemented with an interrupt
          //colorChase (strip.Color(255, 25, 25), 5);                                             // Color chase animations, red, green, blue indicating that the light are about to shut down
          //colorChase2(strip.Color(25, 255, 25), 5);
          //colorChase (strip.Color(25, 25, 255), 5);
         
          colorWipe (strip.Color (0, 0, 0), 0);                                                   // This is needed for turn everything off, clear all pixels. More efficient with this here
          strip.show();
                                }                        
        
      if (senseMotion == HIGH) {                                                                 // If motion sensor 2 (Downstairs) if high go to next line
          digitalWrite(RELAY_PIN, HIGH);
          colorWipe2 (strip.Color(30, 50, 255), 0);
          strip.show();
          delay(10000);
          
          //colorChase (strip.Color(255, 25, 25), 5);
          //colorChase2 (strip.Color(25, 255, 25), 5);
          //colorChase (strip.Color(25, 25, 255), 5);
          colorWipe2 (strip.Color(0, 0, 0), 0);
          strip.show();
                                 }  
                                                      }
      else {                                                                                    // no motion = no lights or animate til off
          digitalWrite(RELAY_PIN, LOW);
          digitalWrite (motionPin, LOW);                                                        //turning motion pins low, doesnt seem to make a difference either.
          digitalWrite (motionPin2, LOW);
          //colorWipe (strip.Color(0, 0, 0), 30);
          strip.show();
           }

            }





//Function time!


// LED animation fuction, Fill the dots one after the other with a color

void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
                                              }
                                          }
                                                                                                                        
                                          
// LED animate the other direction                                         
                                         
void colorWipe2(uint32_t c, uint8_t wait) {
  for(uint16_t i=664; i<strip.numPixels(); i--) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
                                              }
                                          }
                                          
                                          
// Every other LED is on (from arduino forum)

void everyOther(uint32_t c, uint8_t wait) {
  for(uint16_t k=0; k<strip.numPixels(); k++) {
    
      strip.setPixelColor(2*k, c); 
      strip.show();
      delay(wait);    
    
                                              }
  
  
                                        }

//Opposite from above function (from arduino forum)

void everyOther2(uint32_t c, uint8_t wait) {
  for(uint16_t k=0; k<strip.numPixels(); k++) {
    
      strip.setPixelColor((2*k+1), c); 
      strip.show();
      delay(wait);    
    
                                                }
  
  
                                        }

//Rainbow fade effect (from adafruit)

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
                                        }
    strip.show();
    delay(wait);
                        }
                           }



// Slightly different, this makes the rainbow equally distributed throughout

void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
                                        }
    strip.show();
    delay(wait);
                          }
                                }





// Chase one dot down the full strip.

   void colorChase(uint32_t c, uint8_t wait) {
   int i;

                                                                                                  // Start by turning all pixels off:
    for(i=0; i<strip.numPixels(); i++)
      strip.setPixelColor(i, 0);

                                                                                                  // Then display one pixel at a time:
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);                                                                  // Set new pixel 'on'
      strip.show();                                                                               // Refresh LED states
      strip.setPixelColor(i, 0);                                                                  // Erase pixel, but don't refresh!
      delay(wait);
                                        }

  strip.show();                                                                                   // Refresh to turn off last pixel
                                            }
                                            
                                  
                                            
                                            
// Chase one dot down the full strip, opposite direction.

   void colorChase2(uint32_t c, uint8_t wait) {
   int i;
                                                                                                 // Start by turning all pixels off:
    for(i=0; i<strip.numPixels(); i++)
      strip.setPixelColor(i, 0);

                                                                                                 // Then display one pixel at a time:
    for(i=59; i<strip.numPixels(); i--) {
      strip.setPixelColor(i, c);                                                                 // Set new pixel 'on'
      strip.show();                                                                              // Refresh LED states
      strip.setPixelColor(i, 0);                                                                 // Erase pixel, but don't refresh!
      delay(wait);
                                        }

  strip.show();                                                                                 // Refresh to turn off last pixel
                                            }                                            





// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.

uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}






// "Larson scanner" = Cylon/KITT bouncing light effect

void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait) {
  int i, j, pos, dir;

  pos = 0;
  dir = 1;

  for(i=0; i<((strip.numPixels()-1) * 4); i++) {
    
    
    // Draw 5 pixels centered on pos.  setPixelColor() will clip
    // any pixels off the ends of the strip, no worries there.
    // we'll make the colors dimmer at the edges for a nice pulse
    // look
    
    
    strip.setPixelColor(pos - 2, strip.Color(r/4, g/4, b/4));
    strip.setPixelColor(pos - 1, strip.Color(r/2, g/2, b/2));
    strip.setPixelColor(pos, strip.Color(r, g, b));
    strip.setPixelColor(pos + 1, strip.Color(r/2, g/2, b/2));
    strip.setPixelColor(pos + 2, strip.Color(r/4, g/4, b/4));

    strip.show();
    delay(wait);
    
    
    // If we wanted to be sneaky we could erase just the tail end
    // pixel, but it's much easier just to erase the whole thing
    // and draw a new one next time.
    
    
    for(j=-2; j<= 2; j++) 
      strip.setPixelColor(pos+j, strip.Color(0,0,0));
      
    // Bounce off ends of strip
    
    pos += dir;
    if(pos < 0) {
      pos = 1;
      dir = -dir;
    } 
    else if(pos >= strip.numPixels()) {
      pos = strip.numPixels() - 2;
      dir = -dir;
    }
  }
  
}

This is the function down

// LED animation fuction, Fill the dots one after the other with a color

void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
                                              }
                                          }
                                                                                                                        
                                          
// LED animate the other direction                                         
                                         
void colorWipe2(uint32_t c, uint8_t wait) {
  for(uint16_t i=664; i<strip.numPixels(); i--) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
                                              }
                                          }

Do this work likes expected?

i<strip.numPixels()

is always true until i = 65535. (0 - 1)

Yes,is going good but the whole animation for 664 LEDs is slow.

For both colorwipes so I think should I turn on them by groups but I don't know how to do it

After every neopixel the µC must send the data for 664 leds * 3 bytes= 1992 bytes.

Send first all the pixels and after that strip.show().

Or make groups

If(i%10==0 || i == strip.numPixels-1){
   strip.show();
}

how can I make groups? I think it suits my project better.

but then you don't get the wipe visual effect...

Thats the point...I think loading 3 groups of pixels instead one by one is better.

I use segmentation to group the LED's on a LED strip together.

perhaps this will help.

void fDo_LEDs( void *pvParameters )
{
  const int Brightness = 200;
  const int SEG = 6; // how many parts you want to separate the led strip into
  const int ledCount = LED_COUNT; //total number of leds in the strip
  int iFreqVal[7];
  int j;
  leds.begin(); // Call this to start up the LED strip.
  clearLEDs( ledCount );  // This function, defined below, de-energizes all LEDs...
  leds.show();  // ...but the LEDs don't actually update until you call this.
  leds.setBrightness( Brightness ); //  1 = min brightness (off), 255 = max brightness.
  for (;;)
  {
    if (xQueueReceive( xQ_LED_Info, &iFreqVal,  portMAX_DELAY) == pdTRUE)
    {
      j = 0;
      //assign different values for different parts of the led strip
      for (j = 0; j < ledCount; j++)
      {
        if ( (0 <= j) && (j < (ledCount / SEG)) )
        {
          //log_i( "segment 0 %d", iFreqVal[0] );
          set( j, iFreqVal[0], ledCount, SEG ); // set the color of led
        }
        else if ( ((ledCount / SEG) <= j) && (j < (ledCount / SEG * 2)) )
        {
          set( j, iFreqVal[0], ledCount, SEG );
        }
        else if ( ((ledCount / SEG * 2) <= j) && (j < (ledCount / SEG * 3)) )
        {
          set( j, iFreqVal[0], ledCount, SEG );
        }
        else if ( ((ledCount / SEG * 3) <= j) && (j < (ledCount / SEG * 4)) )
        {
          set( j, iFreqVal[0], ledCount, SEG );
        }
        else if ( ((ledCount / SEG * 4) <= j) && (j < (ledCount / SEG * 5)) )
        {
          set( j, iFreqVal[0], ledCount, SEG );
        }
        else
        {
          set( j, iFreqVal[0], ledCount, SEG );
        }
      }
      leds.show();
    }
    xEventGroupSetBits( eg, evtDo_AudioReadFreq );
  }
  vTaskDelete( NULL );
} // void fDo_ LEDs( void *pvParameters )
////

You mean Just turn them on 3 at a time instead of 1?

With 666 neopixels you can't have a fast show. It is serial and serial is relatively slow. After each frame there must be a Treset >280µs.

666 * 24bit = 15984 bit. That gives 0,02s/frame @800kHz. Or max 50pixel/s or >13s for the whole 666 pixel. Without processor time for the count loop.

But if you call show 3 times less often you’ll go 3 times faster. Visually you’ll see groups of three pixels lighting up one after another every 20ms

Just load all the LEDS with new data and then call show once at the end. Works quite well.

But that’s not going to visually deliver a wipe. The strip will turn on solid red or whatever color is chosen in a blink of an eye (20ms give or take)

Done it


// This system utilizes an Atmel Atmega 328p MCU along with 2 PIR (Pyroelectric infrared) Sensors (HC-SR501) and a Digital RGB LED strip (WS2811).
// One sensor placed at the bottom of the stairs (or where ever) and one at the top. Each sensor triggers a different animation (walking up or walking down) along with a shut down warning animation.
// Just modify the function calls in the void loop() and the actual functins towards the bottom area to change the animations, color, etc. colorWipe for example. 
// The four parameters it takes are the RGB pixels followed by the speed at which you wish to run the animations. 0, 0, 0 would mean the LEDS are off and 255, 255, 255 means that they are all white/full brightness.




// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_RGB     Pixels are wired for RGB bitstream
//   NEO_GRB     Pixels are wired for GRB bitstream
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels)
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip)

#include <Adafruit_NeoPixel.h>
#include <FastLED_NeoPixel.h>
 // Which pin on the Arduino is connected to the LEDs?
#define DATA_PIN 6
// How many LEDs are attached to the Arduino?
#define NUM_LEDS 664
// LED brightness, 0 (min) to 255 (max)
#define BRIGHTNESS 255
Adafruit_NeoPixel strip = Adafruit_NeoPixel(664, 6, NEO_GRB + NEO_KHZ800);


const int RELAY_PIN = 2;
int motionPin = 8;                                                                                 // PIR Input pin 8, UPSTAIRS
int motionPin2 = 7;                                                                                // PIR 2 Input pin 7, DOWNSTAIRS
int senseMotion = 0;                                                                               // variable to hold current state of motion detector
int senseMotion2 = 0;                                                                              // 2nd variable for 2nd sensor




void setup() {
   pinMode(RELAY_PIN, OUTPUT);
  pinMode(motionPin, INPUT);                                                                      //PIRs declared as inputs
  pinMode(motionPin2, INPUT);
   digitalWrite(RELAY_PIN, HIGH);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  
  rainbow (0, 3);
  strip.show();
}

void loop() {
  
    senseMotion = digitalRead (motionPin);                                                        //set variables equal to what our sensors are reading (on or off)
    senseMotion2 = digitalRead (motionPin2);
    
      if (senseMotion == HIGH || senseMotion2 == HIGH) {                                          // Testing both sensors at same time, if high, go to apropriate line.
          
          if (senseMotion2 == HIGH) {                                                               // If Upstairs motion sensor is triggered...
          digitalWrite(RELAY_PIN, HIGH);
          colorWipeUP (strip.Color (30, 50, 255), 0);                                             // White/blue color sweep going up stairs (Towards the arrow on the strip)
          strip.show();                                                                           // This being enabled or not, doesnt seem to make a difference. NVM it looks like its more responsive when trying to activate the PIRs one after another
          delay (10000);                                                                          // Wait so someone can get to the bottom or top of stairs, will remove this when 2nd sensor is implemented with an interrupt
          //colorChase (strip.Color(255, 25, 25), 5);                                             // Color chase animations, red, green, blue indicating that the light are about to shut down
          //colorChase2(strip.Color(25, 255, 25), 5);
          //colorChase (strip.Color(25, 25, 255), 5);
         
          colorWipeUP (strip.Color (0, 0, 0), 0);                                                   // This is needed for turn everything off, clear all pixels. More efficient with this here
          strip.show();
                                }                        
        
      if (senseMotion == HIGH) {                                                                 // If motion sensor 2 (Downstairs) if high go to next line
          digitalWrite(RELAY_PIN, HIGH);
          colorWipeDOWN (strip.Color(30, 50, 255), 0);
          strip.show();
          delay(10000);
          
          //colorChase (strip.Color(255, 25, 25), 5);
          //colorChase2 (strip.Color(25, 255, 25), 5);
          //colorChase (strip.Color(25, 25, 255), 5);
          colorWipeDOWN (strip.Color(0, 0, 0), 0);
          strip.show();
                                 }  
                                                      }
      else {                                                                                    // no motion = no lights or animate til off
          digitalWrite(RELAY_PIN, LOW);
          digitalWrite (motionPin, LOW);                                                        //turning motion pins low, doesnt seem to make a difference either.
          digitalWrite (motionPin2, LOW);
          //colorWipe (strip.Color(0, 0, 0), 30);
          strip.show();
           }

            }





//Function time!


// LED animation fuction, Fill the dots one after the other with a color

void colorWipeDOWN(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i+=3) {
      strip.setPixelColor(i, c);
      
        strip.setPixelColor(i+1, c);
        
        strip.setPixelColor(i+2, c);
        
        strip.show();
      delay(wait);
                                              }
                                          }
                                                                                                                        
                                          
// LED animate the other direction                                         
                                         
void colorWipeUP(uint32_t c, uint8_t wait) {
  for(uint16_t i=663; i<strip.numPixels(); i-=3) {
      strip.setPixelColor(i, c);
      
        strip.setPixelColor(i-1, c);
        
        strip.setPixelColor(i-2, c);
        
        strip.show();
      delay(wait);
                                              }
                                          }
                                          
                                          
// Every other LED is on (from arduino forum)

void everyOther(uint32_t c, uint8_t wait) {
  for(uint16_t k=0; k<strip.numPixels(); k++) {
    
      strip.setPixelColor(2*k, c); 
      strip.show();
      delay(wait);    
    
                                              }
  
  
                                        }

//Opposite from above function (from arduino forum)

void everyOther2(uint32_t c, uint8_t wait) {
  for(uint16_t k=0; k<strip.numPixels(); k++) {
    
      strip.setPixelColor((2*k+1), c); 
      strip.show();
      delay(wait);    
    
                                                }
  
  
                                        }







// Slightly different, this makes the rainbow equally distributed throughout

void rainbow(unsigned long wait, unsigned int numLoops) {
	for (unsigned int count = 0; count < numLoops; count++) {
		// iterate through all 8-bit hues, using 16-bit values for granularity
		for (unsigned long firstPixelHue = 0; firstPixelHue < 65536; firstPixelHue += 256) {
			for (unsigned int i = 0; i < strip.numPixels(); i++) {
				unsigned long pixelHue = firstPixelHue + (i * 65536UL / strip.numPixels()); // vary LED hue based on position
				strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));  // assign color, using gamma curve for a more natural look
			}
			strip.show();
			delay(wait);
		}
	}
}





// Chase one dot down the full strip.

   void colorChase(uint32_t c, uint8_t wait) {
   int i;

                                                                                                  // Start by turning all pixels off:
    for(i=0; i<strip.numPixels(); i++)
      strip.setPixelColor(i, 0);

                                                                                                  // Then display one pixel at a time:
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);                                                                  // Set new pixel 'on'
      strip.show();                                                                               // Refresh LED states
      strip.setPixelColor(i, 0);                                                                  // Erase pixel, but don't refresh!
      delay(wait);
                                        }

  strip.show();                                                                                   // Refresh to turn off last pixel
                                            }
                                            
                                  
                                            
                                            
// Chase one dot down the full strip, opposite direction.

   void colorChase2(uint32_t c, uint8_t wait) {
   int i;
                                                                                                 // Start by turning all pixels off:
    for(i=0; i<strip.numPixels(); i++)
      strip.setPixelColor(i, 0);

                                                                                                 // Then display one pixel at a time:
    for(i=59; i<strip.numPixels(); i--) {
      strip.setPixelColor(i, c);                                                                 // Set new pixel 'on'
      strip.show();                                                                              // Refresh LED states
      strip.setPixelColor(i, 0);                                                                 // Erase pixel, but don't refresh!
      delay(wait);
                                        }

  strip.show();                                                                                 // Refresh to turn off last pixel
                                            }                                            





// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.

uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}






// "Larson scanner" = Cylon/KITT bouncing light effect

void scanner(uint8_t r, uint8_t g, uint8_t b, uint8_t wait) {
  int i, j, pos, dir;

  pos = 0;
  dir = 1;

  for(i=0; i<((strip.numPixels()-1) * 4); i++) {
    
    
    // Draw 5 pixels centered on pos.  setPixelColor() will clip
    // any pixels off the ends of the strip, no worries there.
    // we'll make the colors dimmer at the edges for a nice pulse
    // look
    
    
    strip.setPixelColor(pos - 2, strip.Color(r/4, g/4, b/4));
    strip.setPixelColor(pos - 1, strip.Color(r/2, g/2, b/2));
    strip.setPixelColor(pos, strip.Color(r, g, b));
    strip.setPixelColor(pos + 1, strip.Color(r/2, g/2, b/2));
    strip.setPixelColor(pos + 2, strip.Color(r/4, g/4, b/4));

    strip.show();
    delay(wait);
    
    
    // If we wanted to be sneaky we could erase just the tail end
    // pixel, but it's much easier just to erase the whole thing
    // and draw a new one next time.
    
    
    for(j=-2; j<= 2; j++) 
      strip.setPixelColor(pos+j, strip.Color(0,0,0));
      
    // Bounce off ends of strip
    
    pos += dir;
    if(pos < 0) {
      pos = 1;
      dir = -dir;
    } 
    else if(pos >= strip.numPixels()) {
      pos = strip.numPixels() - 2;
      dir = -dir;
    }
  }
  
}

So it now turns on by groups of 3 .but for this you sacrifice the smooth colorwipe.For my project is not a big difference but is a lot faster than loading one led by one led.

void colorWipeDOWN(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i+=3) {
      strip.setPixelColor(i, c);
      
        strip.setPixelColor(i+1, c);
        
        strip.setPixelColor(i+2, c);
        
        strip.show();
      delay(wait);
                                              }
                                          }
                                                                                                                        
                                          
// LED animate the other direction                                         
                                         
void colorWipeUP(uint32_t c, uint8_t wait) {
  for(uint16_t i=663; i<strip.numPixels(); i-=3) {
      strip.setPixelColor(i, c);
      
        strip.setPixelColor(i-1, c);
        
        strip.setPixelColor(i-2, c);
        
        strip.show();
      delay(wait);
                                              }
                                          }

Three times faster :wink:

That's tricky -- rolling past zero into UINT32_MAX.

Is it safe for strip.setPixelColor(i-2, c);?

Yes, the function tests the index against the strip length but usage of unsigned does weird stuff upon subtraction… the for loop is weird it works because when you go under 0 you roll back to a large number which is greater than the number of pixels so the for loop ends and indeed setPixelColor saves the day by not accessing the underlying array out of bounds. It also works because 663 can be divided by 3 so no pixel is left out (edited out as it works all the time since there is rollover)

for my project.It just goes in Reverse based on the pir sensor that triggers the animation for colorwipe

Thanks for everyone that helped me for this project <3.