Page 98 - MDP2020-1
P. 98

|    인천전자마이스터고등학교  ·············································································································
            92

                }
                  else  if(phValue  <=    410){
                    for(int  i=0;  i<NUM_LEDS;  i++){
                colorWipe(strip.Color(255,255,0,0),0);
                delay(1500);
                  }
                  }
                  else{
                  rainbow(10);
                  }
            }


            void  colorWipe(uint32_t  co,  uint8_t  wait){
            for(uint16_t  i=0;  i<strip.numPixels();  i++){
            strip.setPixelColor(i,co);
            strip.show();
            delay(wait);
            }
            }


            void  theaterChase(uint32_t  color,  int  wait)  {
                for(int  a=0;  a<10;  a++)  {
                    for(int  b=0;  b<3;  b++)  {
                        strip.clear();
                        for(int  c=b;  c<strip.numPixels();  c  +=  3)  {
                            strip.setPixelColor(c,  color);
                        }
                        strip.show();
                        delay(wait);
                    }
                }
            }


            void  rainbow(int  wait)  {
                for(long  firstPixelHue  =  0;  firstPixelHue  <  5*65536;  firstPixelHue  +=  256)  {
                    for(int  i=0;  i<strip.numPixels();  i++)  {
                        int  pixelHue  =  firstPixelHue  +  (i  *  65536L  /  strip.numPixels());
                        strip.setPixelColor(i,  strip.gamma32(strip.ColorHSV(pixelHue)));
                    }
                    strip.show();
                    delay(wait);
                }
            }
   93   94   95   96   97   98   99   100   101   102   103