Problems with displaying different sensor values on lcd with ir sensor.

PaulS:
Of course it does. That the code does not do what you expect simply means that your expectations are wrong. But, what you expect the code to do, and what it actually does, are mysteries the my crystal ball can't crack.

The code would work if the data on the lcd was updated in real time,but it's not. I made a function but I still get the same result I got at the start. It's still the same problem, it just looks nicer now. I still dont know how to make it loop in the If function or how to make the data upload all the time in real time onto the lcd.