#include <Servo.h>
#include "LiquidCrystal_I2C.h"
Servo myservo;
int val;
LiquidCrystal_I2C lcd(0x27,20,4);// set the LCD address to 0x27 for a 20 chars and 4 line display
void setup() {
myservo.attach(9);
Serial.begin(9600);
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
}
void loop() {
val = analogRead(A0);
val = map (val, 0, 1023, 0, 180);
myservo.write(val);
Serial.println(val);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Sudut Servo : ");
lcd.print(val);
delay(20);
}