VL53L1X issue

Hi,
I need help with an issue with a GY-53-L1X
The sketch uploads fine but i dont have consistance readings of the sensor, its not stable, and at some point i can only see “0 TIMEOUT”
It woulf be very helpful if someone gave me opinions or/and solutions
I have uploaded this sketch:

#include <Wire.h>
#include <VL53L1X.h>
 
VL53L1X VLSENSOR;
 
void setup()
{
  Serial.begin(115200);
  Wire.begin();
  Serial.println("14CORE | VL53L1X Test Code");
  delay(2000);
  Serial.println("Initializing..............")
  Wire.setClock(400000); // use 400 kHz I2C
  VLSENSOR.setTimeout(500);
  if (!VLSENSOR.init())
  {
    Serial.println("Failed to detect and initialize sensor!");
    while (1);
  }
  VLSENSOR.setDistanceMode(VL53L1X::Long);
  VLSENSOR.setMeasurementTimingBudget(50000);
  VLSENSOR.startContinuous(50);
}
 
void loop()
{
  Serial.print(VLSENSOR.read());
  if (VLSENSOR.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
  Serial.println();
  delay(500);
}

It would be very appreciated.

Regards

Increase the sensor.setTiimeout to 5000. Also would remove the delay in your loop.

Also a lot depends on the what you are using. I.e. I have the STM dev kit which came with 3 sensors (left center and right). It is pin compatible with Arduino but most libraries I have played with don't like it if I have more than one of those sensors active on the board (the left and right ones are on a small addon pcb with pinheaders and can be unplugged).

This works fine for me with the Polulu library.