VL6180X I2C adddress detecting but readings are not getting

Hi Team,

In this post regarding VL6180x proximity sensor, the sensor is detecting the address(0x29) but the readings are receiving as 255 value even the object it detected in front of sensor. for reference purpose go through this code snippet wrote in arduino IDE for ESP32-WROVER-IE.

What might be the problem?

Regards,

#include <Wire.h>
#include "Adafruit_VL6180X.h"

#define SDA 23
#define SCL 22

Adafruit_VL6180X vl;

void setup() {
Serial.begin(115200);
delay(1000);

Serial.println("Starting I2C...");
Wire.begin(SDA, SCL);
delay(100);

Serial.println("VL6180X test");

if (!vl.begin()) {
Serial.println("Failed to find VL6180X");
while (1);
}

Serial.println("VL6180X found!");
}

void loop() {
//Serial.println("hi");
uint8_t range = vl.readRange();
uint8_t status = vl.readRangeStatus();

// if (status == VL6180X_ERROR_NONE) {
Serial.print("Range: ");
Serial.println(range);
//}

//delay(500);
}

Paste your code in a code block...

The library shows this for creating an instance...

Adafruit_VL6180X vl = Adafruit_VL6180X();
#include <Wire.h>
#include "Adafruit_VL6180X.h"
 
#define SDA 23
#define SCL 22
 
Adafruit_VL6180X vl;
 
void setup() {
  Serial.begin(115200);
  delay(1000);
 
  Serial.println("Starting I2C...");
  Wire.begin(SDA, SCL);   // ⭐ MUST be before vl.begin()
  delay(100);
 
  Serial.println("VL6180X test");
 
  if (!vl.begin()) {
    Serial.println("Failed to find VL6180X");
    while (1);
  }
 
  Serial.println("VL6180X found!");
}
 
void loop() {
  //Serial.println("hi");
  uint8_t range = vl.readRange();
  uint8_t status = vl.readRangeStatus();
 
//  if (status == VL6180X_ERROR_NONE) {
    Serial.print("Range: ");
    Serial.println(range);
  //}
 
  //delay(500);
}

What does this indicate?