#include #include // https://www.arduino.cc/reference/en/libraries/vl53l1x/ VL53L1X sensor; void setup() { while (!SerialUSB) { } SerialUSB.begin(115200); Wire.begin(); Wire.setClock(400000); // 400 KHz I2C sensor.setTimeout(500); if (!sensor.init()) { SerialUSB.println("Failed to detect and initialize sensor!"); while (1); } sensor.setDistanceMode(VL53L1X::Long); sensor.setMeasurementTimingBudget(50000); sensor.startContinuous(50); } void loop() { sensor.read(); SerialUSB.println(sensor.ranging_data.range_mm); delay(30); }