Los Electrofaster
Published © GPL3+

Potentiometer scale value using a 16x2 LCD

A simple way to represent the value of a potentiometer using a 16x2 LCD.

BeginnerFull instructions provided1 hour2,738
Potentiometer scale value using a 16x2 LCD

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
RGB Backlight LCD - 16x2
Adafruit RGB Backlight LCD - 16x2
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×7
LCD I2C PCF8574 Interface Adapter
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Potentiometer scale value using a 16x2 LCD

Code

Potentiometer scale value using a 16x2 LCD

Arduino
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,16,2);

void setup() {
  lcd.init();
  lcd.backlight();

}

void loop() {
  int value = analogRead(A0); // read of potentiometer value
  int nivel = map(value, 0, 1000, 0, 16);

  lcd.setCursor(0,0);
  lcd.print("Value:");
  lcd.setCursor(7,0);
  lcd.print(value);
  for (int i=0;i<nivel;i++){
    lcd.setCursor(i, 1);
    lcd.print(char(255));
  } 

  delay(200);
  lcd.clear();

}

Credits

Los Electrofaster

Los Electrofaster

8 projects • 7 followers

Comments