Turn on ws2812b By pir sensors (stairway lighting)

One more step with my project till is finished.I have 2 pir sensors (one upstairs and one downstairs) and I want to adapt a line of code found online with my line of code.
THIS IS MY CODE:↓

# include <Adafruit_NeoPixel.h>
# ifdef __AVR__
#  include <avr/power.h>
# endif


#define LED_PIN    6
//#define LED_COUNT 664
#define LED_COUNT 664
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
int k;
int val;
const int RELAY_PIN = 2;
int16_t cur_bright = 255;
unsigned long msecPeriod;
unsigned long msecLst;
int idx;
int idxMax;
int color;
//vars used for rainbow
long CurrentPixelHue = 0;
int  CurrentPixel = 0;
int CurrentAni = 0;
unsigned long msecLastAniStep = 0;
int AniStepDelay = 5;
uint32_t CurrentColor = 0;
long RainBowDone = (5 * 65536);
bool AniDone = true;
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);
  Serial.begin(9600);
  Serial.println("Ready");
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  strip.begin();
  strip.show();
  strip.setBrightness(255);
}


void loop(void)

{


  PumpAni();


  if (Serial.available ())  {
    char c = Serial.read ();
    switch (c)   {
      case 'z':
        AniDone = false;
        CurrentPixelHue = 0;
        CurrentPixel = 0;
        rainbow(2);
        break;
      case 'r':
        Serial.println("RED");
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 0, 0), 0);
        break;
      case 'g':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 255, 0), 0);
        break;
      case 'b':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 0, 255), 0);
        break;
      case 'w':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 255, 255), 0);
        break;
      case 'y':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 255, 0), 0);
        break;
      case 'o':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 0, 255), 0);
        break;
      case 't':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 255, 255), 0);
        break;
      case '.':
        digitalWrite(RELAY_PIN, HIGH);
        break;
      case ',':
        digitalWrite(RELAY_PIN, LOW);
        break;
      case '+':
        cur_bright = cur_bright + 25;
        if (cur_bright > 255)
          cur_bright = 255;
        strip.setBrightness(cur_bright);
        break;
      case '-':
        cur_bright = cur_bright - 25;
        if (cur_bright < 0)
          cur_bright = 10;
        strip.setBrightness(cur_bright);
        break;

      default:
        break;
    }
  }
}



void PumpAni ()
{ //see if it's time for a step..
  unsigned long currMilli = millis();

  if (currMilli - msecLastAniStep >= AniStepDelay)
  {
    msecLastAniStep = currMilli;

    switch (CurrentAni) {
      case 0: colorWipe(CurrentColor, AniStepDelay); break;
      case 1: rainbow(AniStepDelay); break;
    }


  }


}


void rainbow(int wait) {

  AniStepDelay = wait;
  CurrentAni = 1;

  if (CurrentPixel < strip.numPixels())
  { CurrentPixel++;

  }
  else
  {
    CurrentPixel = 0;
    if (CurrentPixelHue < RainBowDone) {
      CurrentPixelHue += 256;
    } else AniDone = true;

  }
  if (!AniDone)
  {
    int pixelHue = CurrentPixelHue + (CurrentPixel * 65536L / strip.numPixels());
    strip.setPixelColor(CurrentPixel, strip.gamma32(strip.ColorHSV(pixelHue)));
    strip.show();
  }
}

void colorWipe(uint32_t color, unsigned long wait)
{
  CurrentAni = 0;
  AniStepDelay = wait;
  CurrentColor  = color;

  if (!AniDone)
  {
    strip.setPixelColor(CurrentPixel, CurrentColor);
    strip.show();
  }

  if (CurrentPixel < strip.numPixels())
  {
    CurrentPixel++;
  } else
  {
    CurrentPixel = 0;
    AniDone = true;
  }



}

and the code I found on the internet

// 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(150, 6, NEO_GRB + NEO_KHZ800);


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(motionPin, INPUT);                                                                      //PIRs declared as inputs
  pinMode(motionPin2, INPUT);
  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...
          colorWipe (strip.Color (30, 50, 255), 5);                                             // 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);
          scanner(200, 0, 255, 1);
          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
          colorWipe2 (strip.Color(30, 50, 255), 5);
          strip.show();
          delay(10000);
          scanner(0, 200, 250, 1);
          //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 (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=149; 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);
  }
}

Is your goal to display neopixel routines when PIR senses a hot body (cats and dogs, too)? If so, move all the neopixel routines into their own functions (with input arguments), and use void loop() for PIR sensing and timing/timeout.

yes.

I will try it,thx

Code works on all cases but I need to make the PIR sensors to permanently work.So when I choose case p it should work on case p

case 'p':
        AniDone = false;
        CurrentPixel = 0;
        { 
          ....  // Here I need a loop so Motion sensors run permanently but not stucking up my code
          
        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.
# include <Adafruit_NeoPixel.h>
# ifdef __AVR__
#  include <avr/power.h>
# endif


#define LED_PIN    6
//#define LED_COUNT 664
#define LED_COUNT 664
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
int k;
int val;
const int RELAY_PIN = 2;
int16_t cur_bright = 255;
unsigned long msecPeriod;
unsigned long msecLst;
int idx;
int idxMax;
int color;
//vars used for rainbow
long CurrentPixelHue = 0;
int  CurrentPixel = 0;
int CurrentAni = 0;
unsigned long msecLastAniStep = 0;
int AniStepDelay = 250;
uint32_t CurrentColor = 0;
long RainBowDone = (5 * 65536);
bool AniDone = true;
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;         


void setup()
{
  pinMode(RELAY_PIN, OUTPUT);
    pinMode(motionPin, INPUT);                                                                      //PIRs declared as inputs
  pinMode(motionPin2, INPUT);
  Serial.begin(9600);
  Serial.println("Ready");
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  strip.begin();
  strip.show();
  strip.setBrightness(255);
}


void loop(void)

{

    

  PumpAni();


  if (Serial.available ())  {
    char c = Serial.read ();
    switch (c)   {
      case 'z':
        AniDone = false;
        CurrentPixelHue = 0;
        CurrentPixel = 0;
        rainbow(2);
        break;
      case 'r':
        Serial.println("RED");
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 0, 0), 0);
        break;
      case 'g':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 255, 0), 0);
        break;
      case 'b':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 0, 255), 0);
        break;
      case 'w':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 255, 255), 0);
        break;
      case 'y':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 255, 0), 0);
        break;
      case 'o':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 0, 255), 0);
        break;
      case 't':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 255, 255), 0);
        break;
      case '.':
        digitalWrite(RELAY_PIN, HIGH);
        break;
      case ',':
        digitalWrite(RELAY_PIN, LOW);
        break;
      case '+':
        cur_bright = cur_bright + 25;
        if (cur_bright > 255)
          cur_bright = 255;
        strip.setBrightness(cur_bright);
        break;
      case '-':
        cur_bright = cur_bright - 25;
        if (cur_bright < 0)
          cur_bright = 10;
        strip.setBrightness(cur_bright);
        break;
        case 'p':
        AniDone = false;
        CurrentPixel = 0;
        { 
          ....  // Here I need a loop so Motion sensors run permanently but not stucking up my code
          
        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();
        }  
            
        break;

      default:
        break;
    }
  }
}


void PumpAni ()
{ //see if it's time for a step..
  unsigned long currMilli = millis();

  if (currMilli - msecLastAniStep >= AniStepDelay)
  {
    msecLastAniStep = currMilli;

    switch (CurrentAni) {
      case 0: colorWipe(CurrentColor, AniStepDelay); break;
      case 1: rainbow(AniStepDelay); break;
    }


  }


}

void colorWipeDOWN(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 colorWipeUP(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);    
    
                                                }
  
  
                                        }







// 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;
    }
  }
  
}

void rainbow(int wait) {

  AniStepDelay = wait;
  CurrentAni = 1;

  if (CurrentPixel < strip.numPixels())
  { CurrentPixel++;

  }
  else
  {
    CurrentPixel = 0;
    if (CurrentPixelHue < RainBowDone) {
      CurrentPixelHue += 256;
    } else AniDone = true;

  }
  if (!AniDone)
  {
    int pixelHue = CurrentPixelHue + (CurrentPixel * 65536L / strip.numPixels());
    strip.setPixelColor(CurrentPixel, strip.gamma32(strip.ColorHSV(pixelHue)));
    strip.show();
  }
}

void colorWipe(uint32_t color, unsigned long wait)
{
  CurrentAni = 0;
  AniStepDelay = wait;
  CurrentColor  = color;

  if (!AniDone)
  {
    strip.setPixelColor(CurrentPixel, CurrentColor);
    strip.show();
  }

  if (CurrentPixel < strip.numPixels())
  {
    CurrentPixel++;
  } else
  {
    CurrentPixel = 0;
    AniDone = true;
  }



}

the code runs but PIR sensors are absent cause they are not in a loop for working.I post the script I used to code my PIRS.

// 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);
          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++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
                                              }
                                          }
                                                                                                                        
                                          
// LED animate the other direction                                         
                                         
void colorWipeUP(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);    
    
                                                }
  
  
                                        }







// 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;
    }
  }
  
}

I broke it down like this... in pseudocode... it could be the template to make your project do what you want, and borrow from other pixel code.

// Declare PIR pin and state variables

int motionPin1 = 8;
int motionPin2 = 7;

// and state-of-PIR variables
bool senseMotion1 = LOW;
bool senseMotion2 = LOW;

//===============================//

// in void setup(), activate the motionPins
pinMode(motionPin1, INPUT);
pinMode(motionPin2, INPUT);

// in void setup(), store state of PIRs
int senseMotion1 = 0;
int senseMotion2 = 0;

//===============================//

// in void loop(), read the PIRs
senseMotion1 = digitalRead (motionPin1);
senseMotion2 = digitalRead (motionPin2);

// check for ANY PIR activity with if() statement
if (senseMotion == HIGH || senseMotion2 == HIGH) {

// if the "upstairs" sensor tripped
if (senseMotion1)

// call the "upstairs" neopixel routine
	upStairs();

// if the "downstairs" sensor tripped
if (senseMotion2)

// call the "downstairs" neopixel routine
	downStairs();

// the functions
void upStairs()
{
     doSomething;
}

void downStairs()
{
     doSomething;
}

It will work with my (case) code?

Yes, your (case) code can replace "upstairs" and "downstairs"

The code compiles,all of the cases work but when I choose the PIR case.It dosent work

# include <Adafruit_NeoPixel.h>
# ifdef __AVR__
#  include <avr/power.h>
# endif


#define LED_PIN    6
//#define LED_COUNT 664
#define LED_COUNT 664
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
int k;
int val;
const int RELAY_PIN = 2;
int16_t cur_bright = 255;
unsigned long msecPeriod;
unsigned long msecLst;
int idx;
int idxMax;
int color;
//vars used for rainbow
long CurrentPixelHue = 0;
int  CurrentPixel = 0;
int CurrentAni = 0;
unsigned long msecLastAniStep = 0;
int AniStepDelay = 250;
uint32_t CurrentColor = 0;
long RainBowDone = (5 * 65536);
bool AniDone = true;
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;         


void setup()
{
  int senseMotion1 = 0;
   int senseMotion2 = 0;

  pinMode(RELAY_PIN, OUTPUT);
 pinMode(motionPin, INPUT);
pinMode(motionPin2, INPUT);
  Serial.begin(9600);
  Serial.println("Ready");
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  strip.begin();
  strip.show();
  strip.setBrightness(255);
}


void loop(void)

{

  senseMotion = digitalRead (motionPin);
  senseMotion2 = digitalRead (motionPin2);  

  PumpAni();


  if (Serial.available ())  {
    char c = Serial.read ();
    switch (c)   {
      case 'z':
        AniDone = false;
        CurrentPixelHue = 0;
        CurrentPixel = 0;
        rainbow(2);
        break;
      case 'r':
        Serial.println("RED");
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 0, 0), 0);
        break;
      case 'g':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 255, 0), 0);
        break;
      case 'b':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 0, 255), 0);
        break;
      case 'w':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 255, 255), 0);
        break;
      case 'y':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 255, 0), 0);
        break;
      case 'o':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(255, 0, 255), 0);
        break;
      case 't':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe (strip.Color(0, 255, 255), 0);
        break;
      case '.':
        digitalWrite(RELAY_PIN, HIGH);
        break;
      case ',':
        digitalWrite(RELAY_PIN, LOW);
        break;
      case '+':
        cur_bright = cur_bright + 25;
        if (cur_bright > 255)
          cur_bright = 255;
        strip.setBrightness(cur_bright);
        break;
      case '-':
        cur_bright = cur_bright - 25;
        if (cur_bright < 0)
          cur_bright = 10;
        strip.setBrightness(cur_bright);
        break;
        case 'p':
       
        AniDone = false;
        CurrentPixel = 0;
        
 





// check for ANY PIR activity with if() statement
if (senseMotion == HIGH || senseMotion2 == HIGH) {

// if the "upstairs" sensor tripped
if (senseMotion)

// call the "upstairs" neopixel routine
	upStairs();

// if the "downstairs" sensor tripped
if (senseMotion2)

// call the "downstairs" neopixel routine
	downStairs();


     }  
            
        break;

      default:
        break;
    }
  }
}


void PumpAni ()
{ //see if it's time for a step..
  unsigned long currMilli = millis();

  if (currMilli - msecLastAniStep >= AniStepDelay)
  {
    msecLastAniStep = currMilli;

    switch (CurrentAni) {
      case 0: colorWipe(CurrentColor, AniStepDelay); break;
      case 1: rainbow(AniStepDelay); break;
    }


  }
}

void upStairs()
{
                                                    
          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();
                                } 
                                 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();
           }
      }
     



void downStairs() 
{
  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();
           }         
}

         
   
       



void colorWipeDOWN(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 colorWipeUP(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);    
    
                                                }
  
  
                                        }







// 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;
    }
  }
  
}

void rainbow(int wait) {

  AniStepDelay = wait;
  CurrentAni = 1;

  if (CurrentPixel < strip.numPixels())
  { CurrentPixel++;

  }
  else
  {
    CurrentPixel = 0;
    if (CurrentPixelHue < RainBowDone) {
      CurrentPixelHue += 256;
    } else AniDone = true;

  }
  if (!AniDone)
  {
    int pixelHue = CurrentPixelHue + (CurrentPixel * 65536L / strip.numPixels());
    strip.setPixelColor(CurrentPixel, strip.gamma32(strip.ColorHSV(pixelHue)));
    strip.show();
  }
}

void colorWipe(uint32_t color, unsigned long wait)
{
  CurrentAni = 0;
  AniStepDelay = wait;
  CurrentColor  = color;

  if (!AniDone)
  {
    strip.setPixelColor(CurrentPixel, CurrentColor);
    strip.show();
  }

  if (CurrentPixel < strip.numPixels())
  {
    CurrentPixel++;
  } else
  {
    CurrentPixel = 0;
    AniDone = true;
  }



}
      case 'p':
        AniDone = false;
        CurrentPixel = 0;
        // check for ANY PIR activity with if() statement
        if (senseMotion == HIGH || senseMotion2 == HIGH) {
          // if the "upstairs" sensor tripped
          if (senseMotion)
            // call the "upstairs" neopixel routine
            upStairs();
          // if the "downstairs" sensor tripped
          if (senseMotion2)
            // call the "downstairs" neopixel routine
            downStairs();
        }
        break;

Verify the PIR case is entered. Try inside the case 'p': putting a Serial.println("CASE: PIR")
Verify the OR case is entered. Try inside the || putting a Serial.println("CASE: PIR:OR")
Verify the senseMotion is entered. Try Serial.println("CASE: PIR:senseMotion")
Verify the senseMotion2 is entered. Try Serial.println("CASE: PIR:senseMotion2")

I added the above lines to your code, and pasted it below... you must enter 'p' first, THEN trip the PIR, THEN wait for the response because of the large delays.

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

#define LED_PIN 6
//#define LED_COUNT 664
#define LED_COUNT 664
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
int k;
int val;
const int RELAY_PIN = 2;
int16_t cur_bright = 255;
unsigned long msecPeriod;
unsigned long msecLst;
int idx;
int idxMax;
int color;
// vars used for rainbow
long CurrentPixelHue = 0;
int CurrentPixel = 0;
int CurrentAni = 0;
unsigned long msecLastAniStep = 0;
int AniStepDelay = 250;
uint32_t CurrentColor = 0;
long RainBowDone = (5 * 65536);
bool AniDone = true;
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;

void setup() {
  int senseMotion1 = 0;
  int senseMotion2 = 0;

  pinMode(RELAY_PIN, OUTPUT);
  pinMode(motionPin, INPUT);
  pinMode(motionPin2, INPUT);
  Serial.begin(9600);
  Serial.println("Ready");
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  strip.begin();
  strip.show();
  strip.setBrightness(255);
}

void loop(void)

{
  senseMotion = digitalRead(motionPin);
  senseMotion2 = digitalRead(motionPin2);

  PumpAni();

  if (Serial.available()) {
    char c = Serial.read();
    switch (c) {
      case 'z':
        AniDone = false;
        CurrentPixelHue = 0;
        CurrentPixel = 0;
        rainbow(2);
        break;
      case 'r':
        Serial.println("RED");
        AniDone = false;
        CurrentPixel = 0;
        colorWipe(strip.Color(255, 0, 0), 0);
        break;
      case 'g':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe(strip.Color(0, 255, 0), 0);
        break;
      case 'b':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe(strip.Color(0, 0, 255), 0);
        break;
      case 'w':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe(strip.Color(255, 255, 255), 0);
        break;
      case 'y':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe(strip.Color(255, 255, 0), 0);
        break;
      case 'o':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe(strip.Color(255, 0, 255), 0);
        break;
      case 't':
        AniDone = false;
        CurrentPixel = 0;
        colorWipe(strip.Color(0, 255, 255), 0);
        break;
      case '.':
        digitalWrite(RELAY_PIN, HIGH);
        break;
      case ',':
        digitalWrite(RELAY_PIN, LOW);
        break;
      case '+':
        cur_bright = cur_bright + 25;
        if (cur_bright > 255) cur_bright = 255;
        strip.setBrightness(cur_bright);
        break;
      case '-':
        cur_bright = cur_bright - 25;
        if (cur_bright < 0) cur_bright = 10;
        strip.setBrightness(cur_bright);
        break;
      case 'p':
      Serial.println("CASE: PIR");
        AniDone = false;
        CurrentPixel = 0;
        // check for ANY PIR activity with if() statement
        if (senseMotion == HIGH || senseMotion2 == HIGH) {
          Serial.println("CASE: PIR:OR");
          // if the "upstairs" sensor tripped
          if (senseMotion)
            Serial.println("CASE: PIR:OR:senseMotion");
            // call the "upstairs" neopixel routine
            upStairs();
          // if the "downstairs" sensor tripped
          if (senseMotion2)
              Serial.println("CASE: PIR:OR:senseMotion2");
          // call the "downstairs" neopixel routine
            downStairs();
        }
        break;
      default:
        break;
    }
  }
}

void PumpAni() {  // see if it's time for a step..
  unsigned long currMilli = millis();

  if (currMilli - msecLastAniStep >= AniStepDelay) {
    msecLastAniStep = currMilli;

    switch (CurrentAni) {
      case 0:
        colorWipe(CurrentColor, AniStepDelay);
        break;
      case 1:
        rainbow(AniStepDelay);
        break;
    }
  }
}

void upStairs() {
  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();
  } 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();
  }
}

void downStairs() {
  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();
  }
}

void colorWipeDOWN(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 colorWipeUP(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);
  }
}

// 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;
    }
  }
}

void rainbow(int wait) {
  AniStepDelay = wait;
  CurrentAni = 1;

  if (CurrentPixel < strip.numPixels()) {
    CurrentPixel++;

  } else {
    CurrentPixel = 0;
    if (CurrentPixelHue < RainBowDone) {
      CurrentPixelHue += 256;
    } else
      AniDone = true;
  }
  if (!AniDone) {
    int pixelHue =
        CurrentPixelHue + (CurrentPixel * 65536L / strip.numPixels());
    strip.setPixelColor(CurrentPixel, strip.gamma32(strip.ColorHSV(pixelHue)));
    strip.show();
  }
}

void colorWipe(uint32_t color, unsigned long wait) {
  CurrentAni = 0;
  AniStepDelay = wait;
  CurrentColor = color;

  if (!AniDone) {
    strip.setPixelColor(CurrentPixel, CurrentColor);
    strip.show();
  }

  if (CurrentPixel < strip.numPixels()) {
    CurrentPixel++;
  } else {
    CurrentPixel = 0;
    AniDone = true;
  }
}

Your color effect functions contains a lot of delays that make it absolutely incompatible with PIR sensors code.
Your code should be rewritten completely to get rid all delays.

I dont know how to do it.Let me explain my project.I have a arduino mega,connected to it a HC-O5 (bluetooth module) and 2 pir sensors.I have a app on my phone that sends a letter and arduino executes the program (example r that changes ws2812B to red

and now I want to make a case for pir sensors.To make them work like normaly.

Using my code I see the relay turns On and Off but nothing happens like to send the color wipe.

and after if I choose PIR mode.I can choose another program for it