A sample program to control one VL53L1 ToF sensor in multizone mode using polling to find out if a measurement is available. Mbed V6.3 but will run any MBed version by dropping replacing this one. Maint6 release.

Dependencies:   X_NUCLEO_53L1A2

Revision:
2:ef5e40bad526
Parent:
1:49e2fad70dfe
Child:
3:d1a3d15a06ff
--- a/main.cpp	Fri Nov 06 15:01:59 2020 +0000
+++ b/main.cpp	Sun Nov 08 14:05:14 2020 +0000
@@ -25,7 +25,12 @@
 
 
 static XNucleo53L1A1 *board=NULL;
+#if (MBED_VERSION  > 60100) 
+UnbufferedSerial  pc(SERIAL_TX, SERIAL_RX); 
+extern "C" void wait_ms(int ms);
+#else
 Serial pc(SERIAL_TX, SERIAL_RX); 
+#endif
 
 void process_interrupt( VL53L1X * sensor,VL53L1_DEV dev );
 void print_results( int devSpiNumber, VL53L1_MultiRangingData_t *pMultiRangingData );
@@ -46,7 +51,7 @@
 
 
     pc.baud(115200);  // baud rate is important as printf statements take a lot of time
-    printf("Polling single multizone\r\n");
+    printf("Polling single multizone mbed = %d \r\n",MBED_VERSION);
 
 // create i2c interface
     ToF_DevI2C *dev_I2C = new ToF_DevI2C(I2C_SDA, I2C_SCL);
@@ -173,6 +178,14 @@
 //                       printf("no_of_object_found %d \n",no_of_object_found);
             }
 
-}    
+}   
+
+        
+#if (MBED_VERSION  > 60100)
+extern "C" void wait_ms(int ms)
+ {
+    thread_sleep_for(ms);
+ }
+ #endif 
      
   
\ No newline at end of file