VCNL4040 Proximity Sensor

I am trying to use the VCNL4040 Proxmity Sensor with and Arduino Nano. I can hook it up and program it but when I run the program it prints out about a dozen values and then hangs with zero as the last value printed. Once this has happened, I have to unplug the Arduino and restart it in order to get it to work again. If I just close the terminal window and re-open it, it tells me the device is not connected.

Hello.

Can you send a photo that clearly shows how you have the sensor connected to your arduino?

I believe I had it connected correctly as it did return some data and then stopped. However, I was only using the arduino as a test device. I have subsequently attached it to the device that will actually be controlling it and it seems to work fine.

Thanks.