//Matthew Tier Joystick LCD Display 12/19/2022
#include <LiquidCrystal.h>
#define joyX A0
#define joyY A1
const int rs = 10, en = 9, d4 = 8, d5 = 7, d6 = 6, d7 =5;//defining the pins for the LCD
int xValue, yValue;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup()
{
lcd.begin(16, 2);//Starting LCD
Serial.begin(9600);//Starting Serial for Joystick
lcd.print("Hello!");
delay(2000);
lcd.clear();
}
void loop()
{
xValue = analogRead(joyX);//Reading X and Y values from joystick
yValue = analogRead(joyY);
lcd.setCursor(0,0);
lcd.print("X Value : ");
lcd.print(xValue);//Displaying xValue on top
lcd.setCursor(0,1);
lcd.print("Y Value : ");
lcd.print(yValue);//Displaying yValue on bottom
delay(500);
lcd.clear();
}