LCD FLikering problem

Dear all.

Here i am attaching below code. Where i am facing Flickering problem . since loop is too fast in execution. it print the previously displayed data .
I am using below circuit . Can some one help me modifying the code

Code5.rar (5.9 KB)

Add a delay in the loop() function. For example at the end of the loop() function : delay(1000);

I have already tried that, It also Delayed the function of key being pressed. I don't want my keys to gets delayed.

Add a delay in the loop() function. For example at the end of the loop() function : delay(1000);

Use a debounce for the keys and update the lcd not faster than 10 times a second. You can use millis() for timing.

You are calling lcd.begin() every single time you writing to the lcd.
lcd.begin() is used to initialize the LCD.
Not only is it time-consuming but it also clears the display which is probably
what is causing what you calling "flickering".
Just like Serial.begin()
lcd.begin() is normally only called once in the setup() function.

--- bill