Solving Approach:

How do you plan to solve it?

 

 

Code

/*Paste your code here*/
const int potPin = A0;
const int ledPins[5] = {3, 4, 5, 6, 10};

void setup() {
  for (int i = 0; i < 5; i++) {
    pinMode(ledPins[i], OUTPUT);
    digitalWrite(ledPins[i], LOW);
  }
}

void loop() {
  int adc = analogRead(potPin);             
  int level = (adc/204);     

 
  for (int i = 0; i < 5; i++) {
    if (i < level) digitalWrite(ledPins[i], HIGH);
    else digitalWrite(ledPins[i], LOW);
  }
}



 

Output

Video

Add video of output (know more)

 

 

 

 

 

Photo of Output

Add a photo of your hardware showing the output.

 

 

 

 

Upvote
Downvote

Submit Your Solution

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