#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define LCD_COLUMNS 20
#define LCD_LINES 4
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
void setup() {
lcd.begin(16, 2); //Setup LCD Display
lcd.backlight();
pinMode(A0, INPUT); //Input Potentiometer
}
void loop() {
int potValue = analogRead(A0); //Potentiometer auslesen
float ratio = (float(10000) / float(1023));
float widerstand = (1023 - potValue) * ratio;
lcd.clear(); //Display leeren
lcd.setCursor(5, 1); //Cursor zentrieren
lcd.print(widerstand); //Widerstand anzeigen
lcd.print(" \364"); //Ohm-Zeichen
delay(500);
}