Led BEER Pong table Arduino Noob Need help

I used the code in this link and modified it to control pins 0-21 (not using pin 13) on my arduino mega for my led table now i have 2 sets of 16 led's that need to be controled separatly by potentiometers. I'm trying to get the led's to light up sequentialy and have the speed increase as the resistance is changed with the potentiometer. But I'm failing at that and I'm failing even more at merging the codes together to work at the same time.

So basically I need pins 0-21 excluding 13 to be my VU meter and pins 22-37 to be potentiometer controlled sequential leds and pins 38-53 to be potentiometer controlled sequential leds.

Could someone please help me, I know its bad to ask for a massive amount of help as soon as you join a fourm but I'm kinda in a bind I need to get it done for my party this weekend.

sorry here's the link http://www.instructables.com/files/orig/F9G/B4OS/G8AS45XZ/F9GB4OSG8AS45XZ.tmp

I know its bad to ask for a massive amount of help

By not posting your Sketch you have gone well beyond asking for help. You are essentially asking someone to write it for you. If you actually want help you will have to participate in the process.

I didnt post it because i thought it was to long, I know this is terribly rude to ask for this amount of help but like I said I'm in a bind. If someone just goes ahead and writes this program I would be more than happy to copensate them for there work. But even if you just give me a nuge in the right direction I'll take it.

// these constants describe the pins. They won't change:
const int soundpin = 8;               //reads the power from the light sensor
const int LED1= 0;                    //LED's 1-6 numbered accordingly
const int LED2= 1;
const int LED3= 2;
const int LED4= 3;
const int LED5= 4; 
const int LED6= 5;                    //LED's 1-6 numbered accordingly
const int LED7= 6;
const int LED8= 7;
const int LED9= 8;
const int LED10= 9; 
const int LED11= 10;                    //LED's 1-6 numbered accordingly
const int LED12= 11;
const int LED13= 12;
const int LED14= 21;
const int LED15= 14; 
const int LED16= 15;                    //LED's 1-6 numbered accordingly
const int LED17= 16;
const int LED18= 17;
const int LED19= 18;
const int LED20= 19; 
const int LED21= 20; 
int sound[4];
int soundav;


void setup()
{
  // initialize the serial communications:
  Serial.begin(9600);
  
  // Provide ground and power by using the analog inputs as normal
  // digital pins.  This makes it possible to directly connect the
  // breakout board to the Arduino.  If you use the normal 5V and
  // GND pins on the Arduino, you can remove these lines.
  pinMode(soundpin, INPUT);
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(LED3, OUTPUT);
  pinMode(LED4, OUTPUT);
  pinMode(LED5, OUTPUT);
  pinMode(LED6, OUTPUT);
  pinMode(LED7, OUTPUT);
  pinMode(LED8, OUTPUT);
  pinMode(LED9, OUTPUT);
  pinMode(LED10, OUTPUT);
  pinMode(LED11, OUTPUT);
  pinMode(LED12, OUTPUT);
  pinMode(LED13, OUTPUT);
  pinMode(LED14, OUTPUT);
  pinMode(LED15, OUTPUT);
  pinMode(LED16, OUTPUT);
  pinMode(LED17, OUTPUT);
  pinMode(LED18, OUTPUT);
  pinMode(LED19, OUTPUT);
  pinMode(LED20, OUTPUT);
  pinMode(LED21, OUTPUT);

}
 void loop() 
{
  for(int num=0;num<4;num++)
  {
    sound[num]=analogRead(soundpin);
    if(num==2)
    {
      soundav=(sound[0]+sound[1]+sound[2]+sound[3])/4;
        if((soundav)>210)
        {
             digitalWrite(LED1,HIGH);
             digitalWrite(LED2, HIGH);   // set the LED on
             digitalWrite(LED3,HIGH);
             digitalWrite(LED4, HIGH);   // set the LED on
             digitalWrite(LED5,HIGH);
             digitalWrite(LED6,HIGH);
             digitalWrite(LED7, HIGH);   // set the LED on
             digitalWrite(LED8,HIGH);
             digitalWrite(LED9, HIGH);   // set the LED on
             digitalWrite(LED10,HIGH);
             digitalWrite(LED11,HIGH);
             digitalWrite(LED12, HIGH);   // set the LED on
             digitalWrite(LED13,HIGH);
             digitalWrite(LED14, HIGH);   // set the LED on
             digitalWrite(LED15,HIGH);
             digitalWrite(LED16,HIGH);
             digitalWrite(LED17, HIGH);   // set the LED on
             digitalWrite(LED18,HIGH);
             digitalWrite(LED19, HIGH);   // set the LED on
             digitalWrite(LED20,HIGH);  
             digitalWrite(LED21,HIGH);  
        }  
        else if((soundav)>200)
        {
             digitalWrite(LED1,HIGH);
             digitalWrite(LED2, HIGH);   // set the LED on
             digitalWrite(LED3,HIGH);
             digitalWrite(LED4, HIGH);   // set the LED on
             digitalWrite(LED5,HIGH);
             digitalWrite(LED6,HIGH);
             digitalWrite(LED7, HIGH);   // set the LED on
             digitalWrite(LED8,HIGH);
             digitalWrite(LED9, HIGH);   // set the LED on
             digitalWrite(LED10,HIGH);
             digitalWrite(LED11,HIGH);
             digitalWrite(LED12, HIGH);   // set the LED on
             digitalWrite(LED13,HIGH);
             digitalWrite(LED14, HIGH);   // set the LED on
             digitalWrite(LED15,HIGH);
             digitalWrite(LED16,HIGH);
             digitalWrite(LED17, HIGH);   // set the LED on
             digitalWrite(LED18,HIGH);
             digitalWrite(LED19, HIGH);   // set the LED on
             digitalWrite(LED20,HIGH);
             digitalWrite(LED21,LOW);
        }  
        else if((soundav)>190)
        {
             digitalWrite(LED1,HIGH);
             digitalWrite(LED2, HIGH);   // set the LED on
             digitalWrite(LED3,HIGH);
             digitalWrite(LED4, HIGH);   // set the LED on
             digitalWrite(LED5,HIGH);
             digitalWrite(LED6,HIGH);
             digitalWrite(LED7, HIGH);   // set the LED on
             digitalWrite(LED8,HIGH);
             digitalWrite(LED9, HIGH);   // set the LED on
             digitalWrite(LED10,HIGH);
             digitalWrite(LED11,HIGH);
             digitalWrite(LED12, HIGH);   // set the LED on
             digitalWrite(LED13,HIGH);
             digitalWrite(LED14, HIGH);   // set the LED on
             digitalWrite(LED15,HIGH);
             digitalWrite(LED16,HIGH);
             digitalWrite(LED17, HIGH);   // set the LED on
             digitalWrite(LED18,HIGH);
             digitalWrite(LED19, HIGH);   // set the LED on
             digitalWrite(LED20,LOW);
             digitalWrite(LED21,LOW);
        }
        else if(soundav>180)
        {
             digitalWrite(LED1,HIGH);
             digitalWrite(LED2, HIGH);   // set the LED on
             digitalWrite(LED3,HIGH);
             digitalWrite(LED4, HIGH);   // set the LED on
             digitalWrite(LED5,HIGH);
             digitalWrite(LED6,HIGH);
             digitalWrite(LED7, HIGH);   // set the LED on
             digitalWrite(LED8,HIGH);
             digitalWrite(LED9, HIGH);   // set the LED on
             digitalWrite(LED10,HIGH);
             digitalWrite(LED11,HIGH);
             digitalWrite(LED12, HIGH);   // set the LED on
             digitalWrite(LED13,HIGH);
             digitalWrite(LED14, HIGH);   // set the LED on
             digitalWrite(LED15,HIGH);
             digitalWrite(LED16,HIGH);
             digitalWrite(LED17, HIGH);   // set the LED on
             digitalWrite(LED18,HIGH);
             digitalWrite(LED19, LOW);   // set the LED on
             digitalWrite(LED20,LOW);
             digitalWrite(LED21,LOW);
        }
         else if(soundav>170)
        {
             digitalWrite(LED1,HIGH);
             digitalWrite(LED2, HIGH);   // set the LED on
             digitalWrite(LED3,HIGH);
             digitalWrite(LED4, HIGH);   // set the LED on
             digitalWrite(LED5,HIGH);
             digitalWrite(LED6,HIGH);
             digitalWrite(LED7, HIGH);   // set the LED on
             digitalWrite(LED8,HIGH);
             digitalWrite(LED9, HIGH);   // set the LED on
             digitalWrite(LED10,HIGH);
             digitalWrite(LED11,HIGH);
             digitalWrite(LED12, HIGH);   // set the LED on
             digitalWrite(LED13,HIGH);
             digitalWrite(LED14, HIGH);   // set the LED on
             digitalWrite(LED15,HIGH);
             digitalWrite(LED16,HIGH);
             digitalWrite(LED17, HIGH);   // set the LED on
             digitalWrite(LED18,LOW);
             digitalWrite(LED19, LOW);   // set the LED on
             digitalWrite(LED20,LOW);
             digitalWrite(LED21,LOW);
        }
         else if(soundav>160)
        {
             digitalWrite(LED1,HIGH);
             digitalWrite(LED2, HIGH);   // set the LED on
             digitalWrite(LED3,HIGH);
             digitalWrite(LED4, HIGH);   // set the LED on
             digitalWrite(LED5,HIGH);
             digitalWrite(LED6,HIGH);
             digitalWrite(LED7, HIGH);   // set the LED on
             digitalWrite(LED8,HIGH);
             digitalWrite(LED9, HIGH);   // set the LED on
             digitalWrite(LED10,HIGH);
             digitalWrite(LED11,HIGH);
             digitalWrite(LED12, HIGH);   // set the LED on
             digitalWrite(LED13,HIGH);
             digitalWrite(LED14, HIGH);   // set the LED on
             digitalWrite(LED15,HIGH);
             digitalWrite(LED16,HIGH);
             digitalWrite(LED17, LOW);   // set the LED on
             digitalWrite(LED18,LOW);
             digitalWrite(LED19, LOW);   // set the LED on
             digitalWrite(LED20,LOW);
             digitalWrite(LED21,LOW);
        }
         else if(soundav>150)
        {
             digitalWrite(LED1,HIGH);
             digitalWrite(LED2, HIGH);   // set the LED on
             digitalWrite(LED3,HIGH);
             digitalWrite(LED4, HIGH);   // set the LED on
             digitalWrite(LED5,HIGH);
             digitalWrite(LED6,HIGH);
             digitalWrite(LED7, HIGH);   // set the LED on
             digitalWrite(LED8,HIGH);
             digitalWrite(LED9, HIGH);   // set the LED on
             digitalWrite(LED10,HIGH);
             digitalWrite(LED11,HIGH);
             digitalWrite(LED12, HIGH);   // set the LED on
             digitalWrite(LED13,HIGH);
             digitalWrite(LED14, HIGH);   // set the LED on
             digitalWrite(LED15,HIGH);
             digitalWrite(LED16,LOW);
             digitalWrite(LED17, LOW);   // set the LED on
             digitalWrite(LED18,LOW);
             dig

You'd be much better off having arrays of pin numbers. Then, you can turn the pins on and off in for loops and shorten the code considerably.

Comments are useful when they aren't stating the obvious:

             digitalWrite(LED4, HIGH);   [glow]// set the LED on[/glow]

Well, duh.

i have 2 sets of 16 led's...pins 0-21 excluding 13...and pins 22-37...and pins 38-53

2 sets, huh?

Create 3 arrays for the 3 sets of pins, with meaningful names. The rest of the code will be much easier if you start with arrays for the pins.

Did I mention that arrays will be useful?
http://arduino.cc/en/Reference/Array

loop()
{
  int val, i;
  val = analogRead(analog_pin);

  val = map(val, 0, 1023, 1, 21);

  for(i=1; i<=21; i++)
  {
    if(i == 13)
     continue;

   if(i<=val)
     digitalWrite(i, HIGH);
   else
     digitalWrite(i, LOW);
  }
}

Do you really have an LED attached to pin 1?

a couple actually why do you ask?

It's generally advised not to use the serial i/o pins for other things.

here's the thing it needs to control a total 53 sets of leds so i can only afford to lose 1 of the 54 outputs and i cant use 13 b/c it wont control the mosfet

You can use the analog pins as digital pins, too.

oh wow really thats great, ok so I will just switch it to one of the analog pins

ok I'm obviously just treading water with this progaming thing and you seem to have the superior knowlege on the topic and I'm running out of time before my party. Paul do you think we could work it out some way that you make the program and i send you compensation possibly off amazon( I use it alot and i have a prime account so i can send what ever we agree on with free shipping)? plz let me know what you think.