// Baca nilai photensiometer di LCD
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
int potpin = A0;
int val;
void setup() {
// put your setup code here, to run once:
lcd.begin(20, 4);
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 255); // scale it to use it with the servo (value between 0 and 180)
lcd.setCursor(7, 1); //sets crusor pada LCD (Colom,Baris)
lcd.println(val); // sets the servo position according to the scaled value
delay(15);
}