Basic Light show with 5 finger interaction and tone

              

                //#include"pitches.h"
                //#include"starwars.h"
                //#include"harrypotter.h"
                #include 
                #include 
                #ifdef __AVR__
                #include  // Required for 16 MHz Adafruit Trinket
                #endif
                
                
                // Which pin on the Arduino is connected to the Neostrip?
                #define PIN 5
                
                // How many Neostrip are attached to the Arduino?
                #define NUMstrip 125
                
                const int buzzer = 11; //buzzer to arduino pin 11
                
                // When setting up the NeoPixel library, we tell it how many strip,
                // and which pin to use to send signals. Note that for older NeoPixel
                // strips you might need to change the third parameter -- see the
                // strandtest examplbe for more information on possible values.
                Adafruit_NeoPixel strip(NUMstrip, PIN, NEO_GRB + NEO_KHZ800);
                
                //#define DELAYVAL 0 // Time (in milliseconds) to pause between strip
                
                int fsrAnalogPin0 = 0; // FSR connected to analog 0
                int fsrAnalogPin1 = 1; // FSR connected to analog 1
                int fsrAnalogPin2 = 2; // FSR connected to analog 2
                int fsrAnalogPin3 = 3; // FSR connected to analog 3
                int fsrAnalogPin4 = 4; // FSR connected to analog 4
                int fsrReading0;  // the analog reading from the FSR resistor divider
                int fsrReading1;  // the analog reading from the FSR resistor divider
                int fsrReading2;  // the analog reading from the FSR resistor divider
                int fsrReading3;  // the analog reading from the FSR resistor divider
                int fsrReading4;  // the analog reading from the FSR resistor divider
                
                
                int LEDbrightness0;
                int LEDbrightness1;
                int LEDbrightness2;
                int LEDbrightness3;
                int LEDbrightness4;
                
                
                
                
                void setup() {
                
                
                  Serial.begin(9600);
                  strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
                  strip.setBrightness(10); // Set BRIGHTNESS to about 1/5 (max = 255)
                  //  TCCR2B = TCCR2B & 0b11111000 | setting;//to adjust divider for timer
                
                  pinMode(buzzer, OUTPUT); // Set buzzer - pin 11 as an output
                  //   startPlayback(sample, sizeof(sample));
                }
                
                
                
                void myTone(int pin, int frequency, int duration) {
                  int startTime = millis();
                  int period = 1000000 / frequency;
                  while ((millis() - startTime) < duration) {
                    digitalWrite(pin, HIGH);
                    delayMicroseconds(period / 2);
                    digitalWrite(pin, LOW);
                    delayMicroseconds(period / 2);
                  }
                }
                
                
                
                void setColor() {
                  for (int i = 0; i < NUMstrip; i++) {
                
                    if (i % 5 == 0)
                    {
                      strip.setPixelColor(i, strip.Color(255, 0, 107));
                    }
                    else if (i % 5 == 1)
                    {
                      strip.setPixelColor(i, strip.Color(255, 153, 0));
                    }
                    else if (i % 5 == 2)
                    {
                      strip.setPixelColor(i, strip.Color(0, 71, 255));
                    }
                    else if (i % 5 == 3)
                    {
                      strip.setPixelColor(i, strip.Color(5, 245, 0));
                    }
                    else if (i % 5 == 4)
                    {
                      strip.setPixelColor(i, strip.Color(255, 255, 255));
                    }
                  }
                  strip.show();   // Send the updated pixel colors to the hardware.
                
                
                }
                
                void loop() {
                  strip.clear();
                
                  fsrReading0 = analogRead(fsrAnalogPin0);
                  fsrReading1 = analogRead(fsrAnalogPin1);
                  fsrReading2 = analogRead(fsrAnalogPin2);
                  fsrReading3 = analogRead(fsrAnalogPin3);
                  fsrReading4 = analogRead(fsrAnalogPin4);
                
                  // we'll need to change the range from the analog reading (0-1023) down to the range // used by analogWrite (0-255) with map!
                  LEDbrightness0 = map(fsrReading0, 0, 1023, 0, 255);
                  LEDbrightness1 = map(fsrReading1, 0, 1023, 0, 255);
                  LEDbrightness2 = map(fsrReading2, 0, 1023, 0, 255);
                  LEDbrightness3 = map(fsrReading3, 0, 1023, 0, 255);
                  LEDbrightness4 = map(fsrReading4, 0, 1023, 0, 255);
                
                
                  //debugging
                  Serial.print("Analog reading0 = ");
                  Serial.println(fsrReading0);
                
                  Serial.print("Analog reading1 = ");
                  Serial.println(fsrReading1);
                
                  Serial.print("Analog reading2 = ");
                  Serial.println(fsrReading2);
                
                  Serial.print("Analog reading3 = ");
                  Serial.println(fsrReading3);
                
                  Serial.print("Analog reading4 = ");
                  Serial.println(fsrReading4);
                
                  //  Serial.print("LEDbrightness = ");
                  //  Serial.println(LEDbrightness3);
                
                  //analogWrite(buzzer, volume);
                  //
                  //// change the volume for next time through the loop:
                  //  volume = volume + fadeAmount;
                  //
                  //  // reverse the direction of the fading at the ends of the fade:
                  //  if (volume <= 0 || volume >= 255) {
                  //    fadeAmount = -fadeAmount;
                  //  }
                  //  // wait for 100 milliseconds to see the volume effect
                  //  delay(100);
                
                
                  for (int i = 0; i < NUMstrip; i++) {
                
                    if (fsrReading0 > 500) {
                      strip.setPixelColor(i, strip.Color(LEDbrightness0, 0, 107));
                      strip.setBrightness(60);
                      strip.show(); // This sends the updated pixel color to the hardware.
                      //    tone(11, 392); //G
                      //    delay(15); // Pause before next pass through loop
                      myTone(buzzer, 392, 10);
                
                
                
                    } else if (fsrReading1 > 500) {
                      strip.setPixelColor(i, strip.Color(LEDbrightness1, 153, 0));
                      strip.setBrightness(20);
                      strip.show(); // This sends the updated pixel color to the hardware.
                      //    tone(11, 440);  //A
                      //    delay(15); // Pause before next pass through loop
                
                
                      myTone(buzzer, 440, 10);
                
                
                    } else if (fsrReading2 > 500) {
                      strip.setPixelColor(i, strip.Color(0, 71, LEDbrightness2));
                      strip.setBrightness(30);
                      strip.show(); // This sends the updated pixel color to the hardware.
                      //    tone(11, 262); //C
                      //    delay(15); // Pause before next pass through loop
                
                      myTone(buzzer, 262, 10);
                
                    } else if (fsrReading3 > 700) {
                      strip.setPixelColor(i, strip.Color(5, LEDbrightness3, 0));
                      strip.setBrightness(40);
                      strip.show(); // This sends the updated pixel color to the hardware.
                      //    tone(11, 293);  //D
                      //    delay(15); // Pause before next pass through loop
                      myTone(buzzer, 293, 10);
                
                    } else if (fsrReading4 > 500) {
                      strip.setPixelColor(i, strip.Color(255, 255, LEDbrightness4));
                      strip.setBrightness(50);
                      strip.show(); // This sends the updated pixel color to the hardware.
                      //    tone(11, 330);  //E
                      //    delay(15); // Pause before next pass through loop
                
                      myTone(buzzer, 330, 10);
                
                    }
                    else if (fsrReading0 <= 500 || fsrReading1 <= 500 || fsrReading2 <= 500 || fsrReading3 <= 500) {
                
                      setColor();
                      strip.setBrightness(10);
                      noTone(buzzer);
                
                      // Fill along the length of the strip in various colors...
                //      colorWipe(strip.Color(255,   0,   0), 50); // Red
                //      colorWipe(strip.Color(  0, 255,   0), 50); // Green
                //      colorWipe(strip.Color(  0,   0, 255), 50); // Blue
                //    
                      // Do a theater marquee effect in various colors...
                //      theaterChase(strip.Color(127, 127, 127), 50); // White, half brightness
                //      theaterChase(strip.Color(127,   0,   0), 50); // Red, half brightness
                //      theaterChase(strip.Color(  0,   0, 127), 50); // Blue, half brightness
                //    
                //      rainbow(10);             // Flowing rainbow cycle along the whole strip
                //      theaterChaseRainbow(50); // Rainbow-enhanced theaterChase variant
                //      
                    }
                
                
                  }
                
                
                }
                
                
                
                
                
                // Some functions of our own for creating animated effects -----------------
                
                // Fill strip pixels one after another with a color. Strip is NOT cleared
                // first; anything there will be covered pixel by pixel. Pass in color
                // (as a single 'packed' 32-bit value, which you can get by calling
                // strip.Color(red, green, blue) as shown in the loop() function above),
                // and a delay time (in milliseconds) between pixels.
                void colorWipe(uint32_t color, int wait) {
                  for(int i=0; i RGB
                        strip.setPixelColor(c, color); // Set pixel 'c' to value 'color'
                      }
                      strip.show();                // Update strip with new contents
                      delay(wait);                 // Pause for a moment
                      firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames
                    }
                  }
                }