//Program menampilkan sudut servo
//By Janeeta Helgaputri Paratmase
#include <LiquidCrystal_I2C.h>;
#include <Servo.h>;
LiquidCrystal_I2C lcd(0x27,16,2);
Servo motor;
int ditekan = 0;
int tombol1,tombol2;
int sudut = 0;
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
motor.attach(3);
pinMode(13, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
motor.write(sudut);
lcd.setCursor(0,0);
lcd.print(" WELCOME TO ");
lcd.setCursor(0,1);
lcd.print(" MY PROJECT ");
delay(1000);
lcd.clear();
}
void loop() {
tombol1 = digitalRead(13);
tombol2 = digitalRead(7);
if(tombol1 == 0){
sudut = sudut + 5;
delay(100);
}
else if(tombol2 == 0){
sudut = sudut - 5;
delay(100);
}
lcd.setCursor(0,0);
lcd.print(" Sudur servo = ");
lcd.setCursor(0,1);
lcd.print(sudut);
}