Rangefinder and PRX confusion

Did you looked at my (very rudimentary) code ?