All submissions

Solving Approach:

How do you plan to solve it?

 

 

Code

/*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;

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:
  pot_value = analogRead(POT_PIN);
  
  value_arr[0] = map(constrain(pot_value, 0, 203),0,203,0,255);
  value_arr[1] = map(constrain(pot_value, 204,407),204,407,0,255);
  value_arr[2] = map(constrain(pot_value, 408,611),408,611,0,255);
  value_arr[3] = map(constrain(pot_value, 612,815),612,815,0,255);
  value_arr[4] = map(constrain(pot_value, 816,1023),816,1023,0,255);

  for(int i=0;i<5; i++)
  {
    analogWrite(pin_arr[i],value_arr[i]);
  
  }

  delay(50);

}

 

Output

Video

Add video of output (know more)

 

https://youtube.com/shorts/0fmvgmyW7b8

 

 

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

Submit Your Solution

Note: Once submitted, your solution goes public, helping others learn from your approach!