Interrupt function of VL53L0X

I am doing a project uses three VL53L0X.I want the sensor only print stuff when the distance is shorter than 100mm. But I don't know how to do it. Can anyone help~~QAQ

I have no idea what a VL53LOX is, but it would be very unusual for a sensor to "print stuff" under any circumstances, sensors not having print capability

So presumably you have it hooked up to an Arduino* which through whatever mechanism is appropriate for that sensor, reads or calculates the distance?

Then all you need to do is:

if (distanceAccordingToSensor < 100) Serial.println("stuff");

*Or are you actually asking how to get the sensor to work on an Arduino in the first place?

Would you be able to share your code? See item #7.

How/why are the interrupts involved?

dougp:
Would you be able to share your code? See item #7.

How/why are the interrupts involved?

dougp:
Would you be able to share your code? See item #7.

How/why are the interrupts involved?

sorry its the first time I use this forum
My code will keep print things out. I want it only print stuff when "if" trigger
Here's my code
|
V
#include <Wire.h>
#include <VL53L0X.h>

#define Sensor1_newAddress 41
#define Sensor2_newAddress 42
#define Sensor3_newAddress 43
//#define Sensor4_newAddress 44

VL53L0X Sensor1;
VL53L0X Sensor2;
VL53L0X Sensor3;
//VL53L0X Sensor4;

void setup()
{
Serial.begin(9600);

Wire.begin();

Sensor1.setAddress(Sensor1_newAddress);
Sensor2.setAddress(Sensor2_newAddress);
Sensor3.setAddress(Sensor3_newAddress);
// Sensor4.setAddress(Sensor4_newAddress);

Sensor1.init();
Sensor2.init();
Sensor3.init();
// Sensor4.init();

Sensor1.setTimeout(8190);
Sensor2.setTimeout(8190);
Sensor3.setTimeout(8190);
//Sensor4.setTimeout(8190);

Sensor1.startContinuous(1000);
Sensor2.startContinuous(1000);
Sensor3.startContinuous(1000);
// Sensor4.startContinuous(1000);
}

void loop()
{
if(Sensor1.readRangeContinuousMillimeters()<=120 && Sensor1.readRangeContinuousMillimeters()>0)
{
Serial.print("Ys");
Serial.print(",");
}
else if (Sensor1.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

else{
Serial.print("No");
Serial.print(',');
}

if(Sensor2.readRangeContinuousMillimeters()<=120 && Sensor2.readRangeContinuousMillimeters()>0)
{
Serial.print("Ys");
Serial.print(",");
}

else if (Sensor2.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

else{
Serial.print("No");
Serial.print(',');
}

if(Sensor3.readRangeContinuousMillimeters()<=120 && Sensor3.readRangeContinuousMillimeters()>0)
{
Serial.print("Ys");
Serial.print(";");
Serial.println();
}

else if (Sensor3.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

else{
Serial.print("No");
Serial.print(';');
Serial.println();
}

/* if(Sensor4.readRangeContinuousMillimeters()<=120 && Sensor4.readRangeContinuousMillimeters()>0)
{
Serial.print("Ys");
Serial.print(";");
Serial.println();
}

else if (Sensor4.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

else{
Serial.print("Letter :");
Serial.print(';');
Serial.println();
}*/
}

fatkin:
sorry its the first time I use this forum
My code will keep print things out. I want it only print stuff when "if" trigger
Here's my code

You don't have to make it so bleeding obvious you completely ignored the advice in the link given in #2, then quoted by you twice.

I don't think your code will work as you don't enable just the one sensor you want to set the new address of, they're all enabled at the same time.