VL53L3CX sensor ranging example. No expansion shield. Satellite board wired straight in to the motherboard. Targetting MbedOS v6.10.
Dependencies: VL53L3CX_mbed
Diff: Main.cpp
- Revision:
- 3:57541677b13b
- Parent:
- 2:6cc14a15a98c
diff -r 6cc14a15a98c -r 57541677b13b Main.cpp --- a/Main.cpp Tue Nov 03 15:17:16 2020 +0000 +++ b/Main.cpp Fri Apr 30 14:46:24 2021 +0000 @@ -16,7 +16,7 @@ #include "mbed.h" //#include "NoShield53L3.h" -#include "vl53lx_class.h" +#include "vl53l3_class.h" #include "vl53L3_I2c.h" #include <time.h> @@ -26,8 +26,15 @@ #define I2C_SCL D15 //static NoShield53L3 *board=NULL; -static VL53LX *sensor = NULL; +static VL53L3 *sensor = NULL; +// MBed V6.x has renamed wait_ms and UnbufferedSerial replaces Serial +#if (MBED_VERSION > 60300) +UnbufferedSerial pc(USBTX, USBRX); +extern "C" void wait_ms(int ms); +#else Serial pc(SERIAL_TX, SERIAL_RX); +#endif + @@ -58,7 +65,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"); @@ -116,3 +123,10 @@ } // while(1) } + +#if (MBED_VERSION > 60300) +void wait_ms(int ms) + { + thread_sleep_for(ms); + } +#endif