I have been trying to get the while loop to actually loop for the whole day but I only get a blank display. The serial write command also doesnt work in the while loop. I know there are unnecessary functions and variables because I tried everything to fix it. I have some experience with JavaScript but i am relatively new to C++ so any help will be appreciated.
Your JavaScript experience should help you to see the problem in this line:
Yes, in that line. That's where the problem is. Take a good, close look at it.
Hint: If the language were JavaScript rather than C++, it would also be a bug in that language, too.
Do you realize you will soon be sending negative position instructions to the lcd?
And that x2 could be 0 at the start of while...(so it will not start).