How to measure the distance between two mobil plates. VCNL4000

Hi,

I have some technical questions about VCNL4000 sensor. If anybody could help me I would be very gratefull

My project consist on two mobile plates placed inside a closed box (with no light inside). I want the sensor measure the distance between those plates and when the distance would be 5 mm a red LED should light. For this project I will use an arduino and I'm looking for one sensor that allows me to do this job. It has to be very accurate in measuring the distance (precision of 1 mm). And It would be better if it could show me the distance in each moment.

Is the VCNL4000 the most appropiate sensor for my project?

Thank you very much for your time

That chip doesn't measure distance. It measures how much of the transmitted IR signal bounces back to the receiver. If the object being sensed is of uniform color and texture you can use the value as a rough approximation of distance.