Noob help with knock sensor and array

I had this posted under Project Guidance. but i think Programming Questions is the appropriate place for this. sorry for the double post

I want to build an led drum light similar to this one
LED snare drum.AVI - YouTube .
I am new to the arduino.I have a piezo attached to analog pin A0. I tried to combine the array example sketch with the knock sensor sketch. I was eventually able to get the array to work with the piezo but it goes through the whole array when the piezo is greater than the threshold,
How would i increment the array pointer +- 1 one time per event ? Or is there an easier way to do this ?

I'm having trouble keeping it from running through the whole array here's what I have so far, if any one could point me in the right direction I would appreciate it. also I have included a video of how it acts with the current code

const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 100;  // threshold value to decide when the detected sound is a knock or not
int timer = 160;           // The higher the number, the slower the timing.
int ledPins[] = { 
  13, 8, 12, 9, 11, 10,  };       // an array of pin numbers to which LEDs are attached
int pinCount = 6;           // the number of pins (i.e. the length of the array)
int sensorReading = 0;      // variable to store the value read from the sensor pin
void setup() {
  int thisPin;
  // the array elements are numbered from 0 to (pinCount - 1).
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);      
  }
}

void loop() {
  sensorReading = analogRead(knockSensor);   
  // loop from the lowest pin to the highest:
   if (sensorReading >= threshold) {
  for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(timer);                  
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);    

  } 
   }
  // loop from the highest pin to the lowest:
   if (sensorReading >= threshold) {
  for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);
  }
}
}

I would like to build this for my nephew
Here's a link to a video of my nephews band

   if (sensorReading >= threshold) {
   if (sensorReading >= threshold) {

Why do you need to test twice?

There is no delay after the LED is turned off before it is turned on again. The effect of turning it off is lost.

  for (int thisPin = 0; thisPin < pinCount; thisPin++) {

Lousy name for a loop index. Usually, loop index variables are single letter names, like i.

PaulS:

  for (int thisPin = 0; thisPin < pinCount; thisPin++) {

Lousy name for a loop index. Usually, loop index variables are single letter names, like i.

Nope, I disagree, that's a fine name for the variable (although I'd prefer "pinIndex" myself) - using a variable name that reflects its function is good style. Using i, j, k for for loops is good style when iterating over numbers, as this is the mathematical convention. Here we are iterating over pins.

Any way to answer your question remember as I stated before I am a noob at this. I have spent about an hour with the arduino

Code:

if (sensorReading >= threshold) {
if (sensorReading >= threshold) {

Why do you need to test twice?

Well let me make this simple I"M A NOOB if i knew I wouldn't be here asking for advice

As for the other part of your all so helpful and knowledge filled reply

Code:

for (int thisPin = 0; thisPin < pinCount; thisPin++) {

Lousy name for a loop index. Usually, loop index variables are single letter names, like i.

That came right from the example that came with the aruindo software. You know the stuff us noobs try to learn from

/*
  Arrays
 
 Demonstrates the use of  an array to hold pin numbers
 in order to iterate over the pins in a sequence. 
 Lights multiple LEDs in sequence, then in reverse.
 
 Unlike the For Loop tutorial, where the pins have to be
 contiguous, here the pins can be in any random order.
 
 The circuit:
 * LEDs from pins 2 through 7 to ground
 
 created 2006
 by David A. Mellis
 modified 30 Aug 2011
 by Tom Igoe 

This example code is in the public domain.
 
 http://www.arduino.cc/en/Tutorial/Array
 */

int timer = 100;           // The higher the number, the slower the timing.
int ledPins[] = { 
  2, 7, 4, 6, 5, 3 };       // an array of pin numbers to which LEDs are attached
int pinCount = 6;           // the number of pins (i.e. the length of the array)

void setup() {
  int thisPin;
  // the array elements are numbered from 0 to (pinCount - 1).
  // use a for loop to initialize each pin as an output:
  for (int thisPin = 0; thisPin < pinCount; thisPin++)  {
    pinMode(ledPins[thisPin], OUTPUT);      
  }
}

void loop() {
  // loop from the lowest pin to the highest:
  for (int thisPin = 0; thisPin < pinCount; thisPin++) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);   
    delay(timer);                  
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);    

  }

  // loop from the highest pin to the lowest:
  for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) { 
    // turn the pin on:
    digitalWrite(ledPins[thisPin], HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(ledPins[thisPin], LOW);
  }
}

Thanks again for the help

Moderator edit: Personal insult removed.
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.