How to calculate the distance to an object using RP Lidar through arduino?

I found a code which changes the brightness of a LED and also changes its colour as the object moves in different angles and also moves in front of the lidar or moves away from it but the problem is the range in which the code is working is only 0.5 meters and not more than it.I tried changing some of the parameters of the code like in the line 109 i changed 500 to 1000 so that the ranges changes from 0.5 meters to 1 meters but the lidar was not working ahead of 0.5 meters.The link of the library and the code which i am using have been attached below.Kindly someone please help.

The code which i am using is named as distance_to_colour and is present inside the examples folder.
THANK YOU.