#include <LiquidCrystal.h>
#include <Wire.h>
LiquidCrystal lcd(12,11,5,4,3,2);
const int ledPin = 10;
const int potentiometerPin = A1;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(potentiometerPin, INPUT);
lcd.begin(16,2);
Wire.begin();
}
void loop() {
int potentiometerValue = analogRead(potentiometerPin);
int brightness = map(potentiometerValue,0,1023,0,255);
digitalWrite(ledPin,brightness);
lcd.setCursor(0,0);
lcd.print("brightness: ");
lcd.print(brightness,DEC);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("Value: ");
lcd.print(potentiometerValue,DEC);
lcd.print(" ");
}