How do you plan to solve it?
As potentiometer rises, turn on the LEDs as you cross bands.
Five LEDs -> 100/5 = 20, that is the band marker. Within a band, 0->20 means 0->100% of that LED.
Use five PWM pins
Read the pot. measurement as percentage , divide by 20 to know which band. get modulo 20 to find luminosity. This band has luminosity derived from modulo of division of the pot by 20
Every band below it is 100%
Every band above it is 0%
// C++ code
//PWM pins 10, 9, 6, 5, 3
int potPin = 0;
int pwmPin[5] = {10, 9, 6, 5, 3};
void setup()
{
int i;
for (i=0; i < 5; i++) {
pinMode(pwmPin[i], OUTPUT);
}
Serial.begin(9600);
}
int band=0;
int lumen=0;
int pot=0;
void loop()
{
int b;
pot = analogRead(potPin);
pot = (float) pot * 100.0 / 1023.0;
Serial.print("Pot (%): "); Serial.println(pot);
band = pot / 20; Serial.print("band: "); Serial.println(band);
lumen = pot % 20; Serial.print("lumen: "); Serial.println(lumen);
// every band below this is at 100%
for (b = 0; b < band; b++) {
analogWrite(pwmPin[b], 255);
}
// this band is at lumenosity lumen which is out of zero to twenty, converted to percentage of 255
lumen = (float) lumen * 255.0 / 20.0;
analogWrite(pwmPin[band], lumen);
// every band above it is dark
for (b = band+1; b < 5; b++) {
analogWrite(pwmPin[b], 0);
}
delay(100); // Wait for 1000 millisecond(s)
}
Add video of output (know more)
Add a photo of your hardware showing the output.