#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
Serial.begin(115200);
}
void loop() {
const int x_val=analogRead(14);
const int y_val=analogRead(27);
delay(100);
lcd.clear();
lcd.setCursor(0,0);
if(x_val<1000){
lcd.print("Right");
}
else if (x_val>3000){
lcd.print("Left");
}
else if (y_val<1000){
lcd.print("Down");
}
else if(y_val>3000){
lcd.print("Up");
}
else{
lcd.print("Centre");
}
}