// LCD1602 to Arduino Uno connection example
#include <LiquidCrystal.h>
const int potPin = A0;
const int backlightpin = 13;
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
void setup() {
lcd.begin(16, 2);
// you can now interact with the LCD, e.g.:
lcd.print("Hello World!");
}
void loop() {
int potValue = analogRead(potPin);
int brightness = map(potValue, 0, 1023, 0, 255);
analogWrite(backlightpin, brightness);
delay(100);
}