A simple example of a ST VL53L3 ToF sensor being used to get range data polling for measurements. Mbed V5.15

Dependencies:   X_NUCLEO_53L3A2

Revision:
2:f57af818d5ac
Parent:
1:9ea3593bac93
--- a/Main.cpp	Mon Oct 19 09:19:26 2020 +0000
+++ b/Main.cpp	Tue May 04 09:03:37 2021 +0000
@@ -1,7 +1,7 @@
 /*
- *  This VL53L1X Expansion board test application performs range measurements
+ *  This VL53L3 Expansion board test application performs range measurements
  *  using the onboard embedded centre sensor, in singleshot, polling mode.
- *  Measured ranges are ouput on the Serial Port, running at 9600 baud.
+ *  Measured ranges are ouput on the Serial Port, running at 115200 baud.
  *
  *  The User Blue button stops the current measurement and entire program,
  *  releasing all resources.
@@ -12,25 +12,30 @@
   //Main_single_polling.h
  
 #include <stdio.h>
+#include <time.h>
 
 #include "mbed.h"
-#include "XNucleo53LX.h"
+#include "XNucleo53L3A2.h"
 #include "vl53L3_I2c.h"
-#include <time.h>
 
 
 // define i2c mcu pins
 #define I2C_SDA   D14 
 #define I2C_SCL   D15 
 
-static XNucleo53LX *board=NULL;
-Serial pc(SERIAL_TX, SERIAL_RX); 
+static XNucleo53L3A2 *board=NULL;
+#if (MBED_VERSION  > 60300)
+    UnbufferedSerial  pc(USBTX, USBRX);
+#else
+    Serial pc(SERIAL_TX, SERIAL_RX);
+#endif
 
 
 
 VL53LX_Dev_t                   devCentre;
 VL53LX_Dev_t                   devLeft;
 VL53LX_Dev_t                   devRight;
+
 VL53LX_DEV                     Dev = &devCentre;
 
 
@@ -40,7 +45,7 @@
 int main()
 {   
     int status;
-    VL53LX * Sensor;
+    VL53L3 * Sensor;
     uint16_t wordData;
 
     static VL53LX_MultiRangingData_t RangingData;
@@ -52,7 +57,7 @@
     vl53L3_DevI2C *dev_I2C = new vl53L3_DevI2C(I2C_SDA, I2C_SCL);
     
     /* creates the 53L1A1 expansion board singleton obj */
-    board = XNucleo53LX::instance(dev_I2C, A2, D8, D2);
+    board = XNucleo53L3A2::instance(dev_I2C, A2, D8, D2);
     printf("board created!\r\n");
 
 
@@ -128,3 +133,4 @@
 //       status = Sensor->VL53LX_StopMeasurement(); 
     
 }
+