#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int potentiometerPin=A0;
int pinLed=5;
int val=0;
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
// put your setup code here, to run once:
}
void loop() {
val=analogRead(potentiometerPin);
val=map(val,0,1023,0,255);
int sensorValue=analogRead(potentiometerPin);
int percentValue=map(sensorValue,0,1023,0,100);
analogWrite(pinLed,val);
float voltage=sensorValue*(5.0/1023.0);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("ADC:");
lcd.print(sensorValue);
lcd.setCursor(0,1);
lcd.print("V:");
lcd.print(voltage);
lcd.print("v");
lcd.setCursor(10,1);
lcd.print("&");
lcd.print(percentValue);
lcd.print("&");
delay(1000);
// put your main code here, to run repeatedly:
}