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
Diff: Main.cpp
- Revision:
- 1:9ea3593bac93
- Parent:
- 0:2a67f2b41fd7
- Child:
- 2:f57af818d5ac
diff -r 2a67f2b41fd7 -r 9ea3593bac93 Main.cpp --- a/Main.cpp Thu Oct 15 12:14:48 2020 +0000 +++ b/Main.cpp Mon Oct 19 09:19:26 2020 +0000 @@ -14,16 +14,16 @@ #include <stdio.h> #include "mbed.h" -#include "XNucleo53L1A1.h" -#include "vl53L1x_I2c.h" +#include "XNucleo53LX.h" +#include "vl53L3_I2c.h" #include <time.h> // define i2c mcu pins -#define VL53L1_I2C_SDA D14 -#define VL53L1_I2C_SCL D15 +#define I2C_SDA D14 +#define I2C_SCL D15 -static XNucleo53L1A1 *board=NULL; +static XNucleo53LX *board=NULL; Serial pc(SERIAL_TX, SERIAL_RX); @@ -49,12 +49,10 @@ pc.baud(115200); // baud rate is important as printf statements take a lot of time printf("Hello world!\r\n"); - vl53L1X_DevI2C *dev_I2C = new vl53L1X_DevI2C(VL53L1_I2C_SDA, VL53L1_I2C_SCL); - - // printf("I2C device created! %d %d\r\n",dev_I2C,*dev_I2C); + vl53L3_DevI2C *dev_I2C = new vl53L3_DevI2C(I2C_SDA, I2C_SCL); /* creates the 53L1A1 expansion board singleton obj */ - board = XNucleo53L1A1::instance(dev_I2C, A2, D8, D2); + board = XNucleo53LX::instance(dev_I2C, A2, D8, D2); printf("board created!\r\n");