#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the I2C address and LCD dimensions
const int potPin = A0;
const int pembagi = 100;
void setup() {
lcd.begin(16, 2); // Initialize the LCD
lcd.setCursor(15, 0);
lcd.print("Hello budy");
for (int i = 0; i < 25; i++){
lcd.scrollDisplayLeft();
delay(200);
}
lcd.clear();
}
void loop() {
int potValue = analogRead(potPin);
int voltage = map(potValue, 0, 1023, 0, 2000);
float hasil = voltage / (float)pembagi;
if (hasil > 9.99){
lcd.setCursor(0, 0);
lcd.print(hasil, 1);
}
else {
lcd.setCursor(0, 0);
lcd.print(hasil, 2);
}
delay(100);
}