SparkFun Forums 

Where electronics enthusiasts find answers.

By steevie
#202082
Hi,
I´m trying to use the ROI funktion of the VL53L1X Sensor on ardiuno.
Im using the SparkFun VL53L1X 4m Laser Distance Sensor Library V1.1.4

I used the setROI(x, y) function to change the ROI.

1. If I change the first value in the function
distanceSensor.setROI(4, 16);
the sensor stops working at all.

2. If I change the second value nothing changes.

I build the following code in the loop to check the functionality with the serial plotter:
Code: Select all
  distanceSensor.setROI(16, 16);
  delay(100);

  distanceSensor.startRanging(); //Write configuration bytes to initiate measurement
  int distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor
  distanceSensor.stopRanging();

  //Serial.print("Distance(mm): ");
  Serial.print(distance);
  Serial.print("     ");



  distanceSensor.setROI(4, 4);
  delay(100);

  distanceSensor.startRanging(); //Write configuration bytes to initiate measurement
  distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor
  distanceSensor.stopRanging();

  Serial.print(distance);
  Serial.println();
can you please help me to change the ROI?
thank you :)
User avatar
By TS-John
#202389
Hi. Thanks for posting on the SparkFun forums.

Is the issue that your product does not work at all, or is the issue that the modifications to the code you are making are not working?

Could you provide a screenshot of the output of output from this device on a serial terminal using the default code provided on the hook-up guide?

Thanks.