int sensorPin = A0; // select the input pin for the potentiometer (or other analog input)
int pinArray[] = {2,3,4,5,6}; // array of outputs LED pins
int count = 0;
int sensorValue = 0; // variable to store the value coming from the sensor

void setup() { // declare the pinArray as an OUTPUT:
  for (count=0;count<6;count++) {
    pinMode(pinArray[count], OUTPUT);
  }
}

void loop() { // read the value from the sensor:
  sensorValue = analogRead(sensorPin); // we have 5 LEDs for 0-1000 range of senzorValue
  if (sensorValue>0){digitalWrite(pinArray[0], HIGH);} // 1-200 lights 1 LED
  if (sensorValue>201){digitalWrite(pinArray[1], HIGH);} // 201-400 lights 2 LED
  if (sensorValue>401){digitalWrite(pinArray[2], HIGH);} // 401-600 lights 3 LED
  if (sensorValue>601){digitalWrite(pinArray[3], HIGH);} // 601-800 lights 4 LED 
  if (sensorValue>801){digitalWrite(pinArray[4], HIGH);}; // 801-1000 lights 5 LED
  delay(50);
  for (count=0;count<6;count++) {
    digitalWrite(pinArray[count], LOW);
  }
}