#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int potPin = A0;
int ledPin = 6;
byte Bar[8] = {
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111
};
void setup() {
lcd.begin(16, 2);
lcd.createChar(1, Bar);
pinMode(ledPin, OUTPUT);
}
void loop() {
int potValue = analogRead(potPin);
int ledBrightness = map(potValue, 0, 1023, 0, 255);
int lcdValue = map(potValue, 0, 1023, 0, 17);
analogWrite(ledPin, ledBrightness);
lcd.clear();
lcd.setCursor(1,0);
lcd.print("LED Brightness");
for (int i = 0; i < lcdValue; i++) {
lcd.setCursor(i, 2);
lcd.print("\x01");
}
delay(100);
}