Vu Meter sketch on ATTiny2313

Hi all,

I need a Little Help. Can someone tell me what I am doing wrong. I am trying to Put the following code on to an ATTiny2313.

The code works fine on the Arduino, but I get nothing when I put it on the 2313. I know the chip works because I can load the Blink sketch on to it and in runs fine.

I am using the following pins on the 2313. D3-5, D4-6, D5-7, D6-8, D7-9, 5v-20, GND- 10. A0-12

Thanks for any help given.

-KC

int led[10] = { 3, 4, 5, 6, 7}; // D3-5 D4-6 D5-7 D6-8 D7-9 On ATTiny 2313  5v-pin 20 GND Pin 10


int leftChannel = 0;  // left channel input


int left, i;


void setup()


{


  for (i = 0; i < 5; i++)  // Tell the arduino that the leds are digital outputs


    pinMode(led[i], OUTPUT);


//   Serial.begin(9600); // Uncomment to enable troubleshooting over serial.


}


void loop()


{


  left = analogRead(leftChannel);  // read the left channel



  left = left / 50;    // adjusts the sensitivity  




  if (left == 0)  // if the volume is 0 then turn off all leds


  {


    for(i = 0; i < 5; i++)


    {


      digitalWrite(led[i], LOW);


    }


  }



  else


  {


    for (i = 0; i < left; i++) // turn on the leds up to the volume level


    {


      digitalWrite(led[i], HIGH);


    }


    for(i = i; i < 5; i++)  // turn off the leds above the voltage level


    {


      digitalWrite(led[i], LOW);


    }


  }


}
    for(i = 0; i < 5; i++)


    {


      digitalWrite(led[i], LOW);


    }


  }

What’s with all the blank lines?

Just the way I copied it over from the page I got it from. But that should not hurt the code, right.

Also I can get to work fine on an ATTiny 84

left = analogRead(leftChannel);  // read the left channel

Attiny2313 don't have an ADC, so analogRead() won't work

Thank you for your reply.