VU Meter Question

Hey guys, I have made what I thought was a workable VU Meter but it doesn't work. The LED and the Mic are connected into the right pin, but it still doesn't work. I've attached the files and the program. Please help! Also it's on an Arduino UNO

int ledPin = 13;
int leftChannel = 0;
int left, i;

void setup()
{

  pinMode(ledPin, OUTPUT);
  pinMode(leftChannel, INPUT);

}

void loop()
{
left = analogRead(leftChannel); 
left = left / 50;   

  if (left == 0)  
     {
     digitalWrite(ledPin, LOW);
  
  }
  
  else
  {
   for (i = 0; i < left; i++)
    {
     digitalWrite(ledPin, HIGH);
    }
   for(i = i; i < 10; i++) 
     {
      digitalWrite(ledPin, LOW);
     }
  }
}

Please use [ code ] tags when posting code makes it more readable. (tip: you can modify your existing post)

Can you add Serial.begin(115200); and some Serial println(left);
in your code to see what analogRead() produces?

I can't see the point of turning one LED on or off more than once.
But then I don't know what "doesn't work" means either.

AWOL:
I can't see the point of turning one LED on or off more than once.

I just want one LED, I know that's not really a VU meter, I just want one LED to turn on when the mic senses sound.

robtillaart:
Can you add Serial.begin(115200); and some Serial println(left);
in your code to see what analogRead() produces?

I'm sorry, I'm not really very good with codes, could you tell me where exactly to insert this. Sorry, I'm kind of a noob (It's okay to laugh at me, I get it).

Nothing wrong with being a noob (we were all once) and no one is laughing at you.
What robtillaart meant by asking you to add the Serial println(left); was so you could see what kind of values (in the ADC)
your microphone is producing.

I meant the following,
This is an often used way to debug Arduino applications.

// code not tested

int ledPin = 13;
int leftChannel = 0;  // better use A0 here, that is short for analog0
int left, i;

void setup()
{
  Serial.begin(1152000);
  pinMode(ledPin, OUTPUT);
  //  pinMode(leftChannel, INPUT);  // do not do this  for analogRead()
}

void loop()
{
  left = analogRead(leftChannel);   
  Serial.print("left:\t");
  Serial.println(left);

  left = left / 50;     // left = [0..20]
  // minimized code here
  if (left == 0)  
  {
    digitalWrite(ledPin, LOW);
  }
  else
  {
    digitalWrite(ledPin, HIGH);
  }
}

Can you post the output it generates?

robtillaart:
Can you post the output it generates?

What do you mean? I looked in the Serial Monitor and selected 115200 baud but all i got was random letters and symbols, it was really long too. what should i do, also nothing happened to the LED with the new program.