I tried to figure the workings of this program. Two boxes are the form of a numeric variable. It is a variable called "present value" and "maximum value".
At first, "0" is on the "maximum". The measured value of the sensor enters to "present value", but I put "10" in this case.
Compare the contents of the box (variable), if the present value is greater, you assign the value to the maximum.
I do not assign to the box if the present value was smaller. In other words, to continue the process of "it is assigned if a variable is larger" and the maximum value is eventually falls to a variable.
This is a "algorithm that seeks the maximum value".
Here is the process from when exiting the loop. I have to convert the maximum value to the text and display on LCD.
I have placed the waiting block at the end for not disappear after displaying on the screen.