How do you plan to solve it?
/*Paste your code here*/
#define LED_1 3
#define LED_2 5
#define LED_3 6
#define LED_4 9
#define LED_5 10
#define POT_PIN A0
uint8_t pin_arr[5] = {LED_1, LED_2, LED_3, LED_4, LED_5};
uint8_t value_arr[5];
int pot_value=0;
int mapped_value = 0;
int wait = 0;
void fadeControl(void)
{
for(int v=0; v<256; v++)
{
analogWrite(pin_arr[0],255-v);
analogWrite(pin_arr[1],v);
analogWrite(pin_arr[2],255-v);
analogWrite(pin_arr[3],v);
analogWrite(pin_arr[4],255-v);
pot_value = analogRead(POT_PIN);
wait = map(pot_value,0,1023,0,10);
delay(wait);
}
for(int v=255; v>=0; v--)
{
analogWrite(pin_arr[0],v);
analogWrite(pin_arr[1],255-v);
analogWrite(pin_arr[2],v);
analogWrite(pin_arr[3],255-v);
analogWrite(pin_arr[4],v);
pot_value = analogRead(POT_PIN);
wait = map(pot_value,0,1023,0,10);
delay(wait);
}
}
void setup() {
// put your setup code here, to run once:
for(int i=0;i<5;i++)
{
pinMode(pin_arr[i],OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
fadeControl();
}
Add video of output (know more)
Add a photo of your hardware showing the output.