Los Electrofaster
Published © GPL3+

Value of a potentiometer using LEDs

In a very simple way you can make a graphic representation of the value of a potentiometer in a series of LEDs

BeginnerFull instructions provided1 hour736
Value of a potentiometer using LEDs

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
LED (generic)
LED (generic)
×8
Resistor 220 ohm
Resistor 220 ohm
×8
Jumper wires (generic)
Jumper wires (generic)
×12
Single Turn Potentiometer- 100k ohms
Single Turn Potentiometer- 100k ohms
×1

Software apps and online services

Arduino IDE
Arduino IDE
Autodesk ThinkerCAD

Story

Read more

Schematics

Potentiometer value by LEDs

Code

Potentiometer value by LEDs

Arduino
onst byte LED[8] = {2,3,4,5,6,7,8,9};


void setup()
{
  Serial.begin(9600);
  // Output for each LED
  for (int i=0; i<8; i++) {
    pinMode (LED[i], OUTPUT);
  }

}

void loop()
{
  int value = analogRead(A0); // read of potentiometer value

  int nivel = map(value, 0, 1010, 0, 8); // map function to get brihtness
  for (int i=0; i<8; i++) {
    digitalWrite(LED[i] , LOW);
  }
  if (nivel > 0) {
    for (int i=0; i<nivel; i++) {
      digitalWrite(LED[i] , HIGH);
    }
  }
  Serial.println(nivel);
  delay(100);
}

Credits

Los Electrofaster

Los Electrofaster

8 projects • 7 followers

Comments