VL53L1X code hanging on sensor.init

So i’m using the continuous example code for the VL53L1X and added some debugging logs. I found out that for this sensor the code hangs on the sensor.init. It does not go to Serial.println(“Failed to detect and initialize sensor!”); line in the if. Does anyone know why this can happen?

Many thanks

Hello.

You can take a look at what is going on in the init() function here. If that is causing your program to hang, then the most likely cause is some issue with the I2C communication between the VL53L1X and your microcontroller. Could you share more details about your setup (like what microcontroller you are using) and post some pictures that show all of your connections?

Could you also try adding the following line of code between lines 19 and 20 of your test program and let us know what that outputs:

Serial.println(sensor.readReg16Bit(sensor.IDENTIFICATION__MODEL_ID), HEX);

- Patrick