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

But it still doesn't work.

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.