John Alexander
/
VL53L3_NoShield_1Sensor_polling_Mb63
Use sensor class
Diff: Main.cpp
- Revision:
- 3:1f36ecdad3c4
- Parent:
- 2:6cc14a15a98c
--- a/Main.cpp Tue Nov 03 15:17:16 2020 +0000 +++ b/Main.cpp Fri Apr 30 15:01:09 2021 +0000 @@ -13,12 +13,12 @@ */ #include <stdio.h> +#include <time.h> #include "mbed.h" //#include "NoShield53L3.h" -#include "vl53lx_class.h" +#include "vl53l3_class.h" #include "vl53L3_I2c.h" -#include <time.h> // define i2c mcu pins @@ -26,8 +26,12 @@ #define I2C_SCL D15 //static NoShield53L3 *board=NULL; -static VL53LX *sensor = NULL; -Serial pc(SERIAL_TX, SERIAL_RX); +static VL53L3 *sensor = NULL; +#if (MBED_VERSION > 60300) + UnbufferedSerial pc(USBTX, USBRX); +#else + Serial pc(SERIAL_TX, SERIAL_RX); +#endif @@ -45,7 +49,7 @@ int status; uint16_t wordData; - DigitalOut xshutdown(D7); + DigitalOut xshutdown(D8); static VL53LX_MultiRangingData_t RangingData; @@ -58,7 +62,7 @@ /* no expansion board so don't use stmpe1600 */ // board = NoShield53L3::instance(dev_I2C, A2, D8, D2); - sensor = new VL53LX(dev_I2C, &xshutdown, A2); + sensor = new VL53L3(dev_I2C, &xshutdown, A2); printf("sensor created!\r\n");