@ScruffR @shiv Using the normal code example the sensor maxes out at 4 feet / 1260 mm.
I copied the Arduino long range example code over to ScruffR’s library port and it works!
In long range mode the sensor will measure up to 6.2 feet away vs. 4 feet with the normal settings which makes a big difference for me.
It’s working great as a trip sensor spanning a 5.5 foot wide hallway with stable output.
I did notice that Christmas lights in the background it will cause random readings to show up using the long range settings so try to keep background lights to a minimum.
Use the code below with this library: https://build.particle.io/build/584f095f31c7319f1d001284
/* This example shows how to use continuous mode to take
range measurements with the VL53L0X. It is based on
vl53l0x_ContinuousRanging_Example.c from the VL53L0X API.
The range readings are in units of mm. */
# include "VL53L0X/VL53L0X.h"
# include "VL53L0X.h"
# include <Wire.h>
// Uncomment ONE of these two lines to get
// - higher speed at the cost of lower accuracy OR
// - higher accuracy at the cost of lower speed
#if defined LONG_RANGE
// lower the return signal rate limit (default is 0.25 MCPS)
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
#if defined HIGH_SPEED
// reduce timing budget to 20 ms (default is about 33 ms)
#elif defined HIGH_ACCURACY
// increase timing budget to 200 ms
int distancemm = sensor.readRangeSingleMillimeters();
if (distancemm >= 9000) //Change 9000 to the maximum distance you want to get readings from. Only readings below this number will serial print.
// action A
Now the only thing left to figure out is how to get the interrupt GPIO pin working and how to set the threshold that triggers it.