#include <LiquidCrystal_I2C.h>
#define led 5
#define pot 36
#define address 0x27
#define col 16
#define lin 2
LiquidCrystal_I2C lcd(address, col, lin);
int ledState = 0;
int potState = 0;
byte lampada[8] = {
0b01110,
0b10001,
0b10001,
0b01010,
0b01110,
0b01010,
0b01110,
0b00000
};
void setup() {
pinMode(led, OUTPUT);
lcd.init();
lcd.backlight();
lcd.createChar(0, lampada);
}
void loop() {
potState = analogRead(pot);
ledState = map(potState, 4095, 0, 255, 0);
analogWrite(led, ledState);
potState = map(potState, 4095, 0, 100, 0);
lcd.clear();
lcd.print("Luminosidade:");
lcd.setCursor(0, 1);
lcd.print(potState);
lcd.print("% ");
lcd.write(0);
delay(500);
}