//Ben Van Noten
//1.3 lcd naam potmeter
//11/9/2023
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
int sensorValue = 0;
int outputValue = 0;
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.setCursor(2,0);
lcd.print("Ben Van Noten");
}
void loop()
{
sensorValue = analogRead(A0);
outputValue = map(sensorValue, 0, 1023, 0, 20);
lcd.setCursor(2,1);
if (outputValue<10)
{
lcd.print(" ");
}
lcd.print(outputValue);
lcd.setCursor(5,1);
if (sensorValue<10)
{
lcd.print(" ");
}
if (sensorValue<100)
{
lcd.print(" ");
}
if (sensorValue<1000)
{
lcd.print(" ");
}
lcd.print(sensorValue);
}