How do you plan to solve it?
/*Paste your code here*/
#define LED1 11
#define LED2 10
#define LED3 9
#define LED4 6
#define LED5 5
#define Pot A0
float Val;
uint8_t D1,D2,D3,D4,D5;
void setup() {
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
}
void loop() {
Val = analogRead(Pot);
if(Val < 205){
D1 = (Val/204)*255;
D2 = D3 = D4 = D5 = 0;
} else if (Val < 410){
D1 = 255;
D2 = ((Val-204)/204)*255;
D3 = D4 = D5 = 0;
} else if( Val<615){
D1 = D2 = 255;
D3= ((Val-408)/204)*255;
D4 = D5 = 0;
} else if (Val<820){
D1 = D2 = D3 = 255;
D4 = ((Val-612)/204)*255;
D5 = 0;
} else {
D1 = D2 = D3 = D4 = 255;
D5 = ((Val-816)/204)*255;
}
analogWrite(LED1,D1);
analogWrite(LED2,D2);
analogWrite(LED3,D3);
analogWrite(LED4,D4);
analogWrite(LED5,D5);
}
Add video of output (know more)
Add a photo of your hardware showing the output.
