can analog input control 4 led output?

hi all friend,
i have 1 simple project with uno + potentiometer + 4 led
i try to use analog input to control 4 led.
my plan is:
when analogRead > 500 , led 1 on
when analogread > 700 , led1 and led 2 on
when analogread > 900, led 1 , led 2 and led 3 on
when analogread > 1100 , all red on.
i try use " if " function but led just dim not bright.

here my code.

/*
  AnalogReadSerial
  Reads an analog input on pin 5, prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A5, and the outside pins to +5V and ground.

  This example code is in the public domain.
*/
int led1 = 8;
int led2 = 9;
int led3 = 10;
int led4 = 11;
int analogout;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT);
  pinMode(led4,OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 5:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
  
  if(sensorValue > 500)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,LOW);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
  }
  if(sensorValue > 700)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,HIGH);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
  }
  if(sensorValue > 900 && sensorValue <1100)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,HIGH);
    digitalWrite(led3,HIGH);
    digitalWrite(led4,LOW);
  }
  if(sensorValue > 1100)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,HIGH);
    digitalWrite(led3,HIGH);
    digitalWrite(led4,HIGH);
  }
  else
  { 
    digitalWrite(led1,LOW);
    digitalWrite(led2,LOW);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
  }    

}

Try something like:

if(sensorValue > 700 && sensorValue <= 900)

ok..thanks..let me try now

same..led just dim..but after full rotation potentiometer all led on with full bright.

How about posting your new code?

Your last if statement sets all LEDS low if sensorValue is not greater than 1000.
So no matter if any were on before, they all get turned off every pass.

ok friend it work now.i just delete or disable “else” function.
here my working code:

/*
  AnalogReadSerial
  Reads an analog input on pin 5, prints the result to the serial monitor.
  Graphical representation is available using serial plotter (Tools > Serial Plotter menu)
  Attach the center pin of a potentiometer to pin A5, and the outside pins to +5V and ground.

  This example code is in the public domain.
*/
int led1 = 8;
int led2 = 9;
int led3 = 10;
int led4 = 11;
int analogout;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT);
  pinMode(led4,OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 5:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(100);        // delay in between reads for stability


   if(sensorValue < 500)
  { 
    digitalWrite(led1,LOW);
    digitalWrite(led2,LOW);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
  }
  if(sensorValue > 500 && sensorValue <=700)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,LOW);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
  }
  if(sensorValue > 700 && sensorValue <=900)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,HIGH);
    digitalWrite(led3,LOW);
    digitalWrite(led4,LOW);
  }
  if(sensorValue > 900 && sensorValue <=1000)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,HIGH);
    digitalWrite(led3,HIGH);
    digitalWrite(led4,LOW);
  }
  if(sensorValue > 1000)
  { 
    digitalWrite(led1,HIGH);
    digitalWrite(led2,HIGH);
    digitalWrite(led3,HIGH);
    digitalWrite(led4,HIGH);
  }
 // else
 // { 
  //  digitalWrite(led1,LOW);
  //  digitalWrite(led2,LOW);
  //  digitalWrite(led3,LOW);
  //  digitalWrite(led4,LOW);
 // }    

}