Devices & Components
Arduino Uno Rev3
Jumper wires (generic)
Rotary potentiometer (generic)
Standard LCD - 16x2 White on Blue
Project description
Code
joystick1.ino
arduino
1//Matthew Tier Joystick LCD Display 12/19/2022 2#include <LiquidCrystal.h> 3#define joyX A0 4#define joyY A1 5 6const int rs = 12, en = 11, d4 = 7, d5 = 6, d6 = 5, d7 =4;//defining the pins for the LCD 7int xValue, yValue; 8LiquidCrystal lcd(rs, en, d4, d5, d6, d7); 9 10void setup() 11{ 12 lcd.begin(16, 2);//Starting LCD 13 Serial.begin(9600);//Starting Serial for Joystick 14 lcd.print("Hello!"); 15 delay(2000); 16 lcd.clear(); 17 18} 19 20void loop() 21{ 22 xValue = analogRead(joyX);//Reading X and Y values from joystick 23 yValue = analogRead(joyY); 24 25 lcd.setCursor(0,0); 26 lcd.print("X Value : "); 27 lcd.print(xValue);//Displaying xValue on top 28 29 lcd.setCursor(0,1); 30 lcd.print("Y Value : "); 31 lcd.print(yValue);//Displaying yValue on bottom 32 33 delay(500); 34 lcd.clear(); 35 36} 37
Downloadable files
Arduino Joystick to LCD Fritz
Fritizing file
Arduino Joystick to LCD Fritz
Circuit Screenshot
Circuit Screenshot

Comments
Only logged in users can leave comments