This library allows you to read from multiple VL53L1X sensors.

Dependencies:   mbed

Fork of VL53L1X_Pololu by Jesus Fausto

Revision:
3:7777bbcf11f6
Parent:
2:f570ff03fb81
--- a/VL53L1X.cpp	Thu Aug 09 18:12:38 2018 +0000
+++ b/VL53L1X.cpp	Thu Aug 09 19:39:36 2018 +0000
@@ -591,7 +591,7 @@
 //  _i2c.requestFrom(address, (uint8_t)17);
   _i2c.read(address, infoToRead, 17, 0);
  
-  wait(.02);
+  wait(.005);
   results.range_status = infoToRead[0];
  
 //  infoToRead[1]; // report_status: not used
@@ -679,7 +679,7 @@
   // Basically, this appears to scale the result by 2011/2048, or about 98%
   // (with the 1024 added for proper rounding).
   ranging_data.range_mm = ((uint32_t)range * 2011 + 0x0400) / 0x0800;
-  wait(.01);
+  wait(.005);
   // VL53L1_copy_sys_and_core_results_to_range_results() end
  
   // set range_status in ranging_data based on value of RESULT__RANGE_STATUS register
@@ -839,6 +839,7 @@
  // setDistanceMode(VL53L1X::Short);//Short Medium Long
   setAddress(addr);//change I2C address for next sensor
   setMeasurementTimingBudget(timing_budget);//min 20ms for Short, 33ms for Medium and Long
+  startContinuous(50);
   wait_ms(100);
   didInitialize = true;
   return true;
@@ -869,12 +870,8 @@
 }
 int VL53L1X::readFromOneSensor(void)
 {
-    startContinuous(50);
-    int variable;
     if (didInitialize)   //create bool
-        variable = read();
+        return read();
     else 
-        variable = -1;  
-    stopContinuous();   
-    return variable; 
+        return -1;  
 }
\ No newline at end of file