Lcd stops displaying

HI friends,
I have 16by2 lcd, all code works fine of displaying joystick values and one potientiometer on lcd,
just problem is that after some time all text dissappears from lcd and no output comes. It starts displaying once i click reset.
code



// include the library code:
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  pinMode(A0,INPUT);
  pinMode(A1,INPUT);
}

void loop() {
  // set the cursor to column 0, line 1
  int j1x = analogRead(A1);
  int j1y = analogRead(A0);
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 0);
  lcd.print("J1x=");
  lcd.print(j1x);
  lcd.setCursor(8,0);
  lcd.print("J1y=");
  lcd.print(j1y);
  lcd.setCursor(0,1);
  lcd.print(analogRead(A2));
  delay(300);
  lcd.clear();
  
}

AO and A1 Connected to joystick
A2 connected to potientiometer

issue resolved .

Please post the resolution so that others that may come upon this thread can benefit.

Ok will post

Hey, the solution is that I just added a lcd.begin(16, 2) at end of void loop and it works fine

Well, there's the point!

That makes no sense at all!

SIgh! :worried:

Let's see if Bill looks at this. ... :face_with_raised_eyebrow:

hey there. can you help me in this post?

That's not a solution. It's a workaround that has no evident reason why it would solve anything.

Don't worry though; odds are the device will break down again and then we can get to the bottom of this :wink:

The hidden sketch is top secret