#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C LCD(0x27, 16, 2);
int pot = A0;
void setup() {
// Initialize the LCD
LCD.begin(16,2);
LCD.backlight();
LCD.setCursor(0, 0);
}
void loop() {
// Read the value from the potentiometer
int value = analogRead(pot);
// Clear the display
LCD.clear();
// Set cursor to the beginning of the first line
LCD.setCursor(0, 0);
// Print the potentiometer value
LCD.print("Pot Value: ");
LCD.print(value);
// Small delay to avoid flickering
delay(500);
}