How to make a trigger event for VL53L1X

Hi all,

I have a Arduino Uno connected to a ST-VL53L1X-SATEL which works fine with the Pololu library.
When running the examples I get fine results.

However, I’m trying to do two things with it, both without succes.
One is more difficult, I want to count people with the sensor, but honestly, don’t know where to start.

The more easy one, I think, is I would like to make a trigger event at a certain distance.

For instance; If the sensor is in a normal situation (room with nobody in it) it’s senses a distance of 1.75m,
The LED should go off. if it senses a distance of 1.25m or less the LED should turn on, if it senses a distance of less then a meter, the LED should start blink.

Does anyone have experience with this or know how to achieve this? Here is the code so far, be aware, this is just the example of Pololu, I did not changed anything.



This example shows how to take simple range measurements with the VL53L1X. The
range readings are in units of mm.

#include <Wire.h>
#include <VL53L1X.h>

VL53L1X sensor;

void setupcolor=#000000[/color]
 Wire.setClockcolor=#000000[/color]; // use 400 kHz I2C

 if color=#000000[/color]
   Serial.println(“Failed to detect and initialize sensor!”);
   while color=#000000[/color];
 // Use long distance mode and allow up to 50000 us (50 ms) for a measurement.
 // You can change these settings to adjust the performance of the sensor, but
 // the minimum timing budget is 20 ms for short distance mode and 33 ms for
 // medium and long distance modes. See the VL53L1X datasheet for more
 // information on range and timing limits.

// Start continuous readings at a rate of one measurement every 50 ms (the
 // inter-measurement period). This period should be at least as long as the
 // timing budget.

void loopcolor=#000000[/color]
 if color=#000000[/color] { Serial.print(" TIMEOUT"); }



refer to this