#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
#define LED_PIN 2
#define POTENTIOMETER_PIN A0
void setup()
{
lcd.init();
lcd.init();
lcd.backlight();
pinMode(LED_PIN, OUTPUT);
}
void loop()
{
float potentiometerValue = analogRead(POTENTIOMETER_PIN);
float motor_speed = potentiometerValue / 4;
analogWrite(LED_PIN, motor_speed);
lcd.setCursor(0,0);
lcd.print("brightness:");
lcd.setCursor(10,0);
lcd.print(motor_speed);
}