#include <LiquidCrystal_I2C.h> // if you don´t have I2C version of the display, use LiquidCrystal.h library instead
LiquidCrystal_I2C lcd(0x27,16,2);
int readPin = A2;
int ledPin = 3;
int readValue;
float Voltage;
void setup() {
pinMode(readPin, INPUT);
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
lcd.begin(16, 2);
}
void loop() {
readValue = analogRead(readPin);
Voltage = (readValue * 5.0) / 1023.0;
lcd.setCursor(0, 0);
lcd.print(Voltage);
analogWrite(ledPin, int(Voltage * 51));
delay(10);
}