VL53L3CX sensor ranging example. No expansion shield. Satellite board wired straight in to the motherboard. Targetting MbedOS v6.10.
Dependencies: VL53L3CX_mbed
Revision 3:57541677b13b, committed 2021-04-30
- Comitter:
- johnAlexander
- Date:
- Fri Apr 30 14:46:24 2021 +0000
- Parent:
- 2:6cc14a15a98c
- Commit message:
- Use published sensor library.; Update serial port pin labels.; Align with MbedOS v6.10.
Changed in this revision
--- 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VL53L3CX_mbed.lib Fri Apr 30 14:46:24 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/ST-Expansion-SW-Team/code/VL53L3CX_mbed/#39a9cd3c85f2
--- a/VL53L3_Lib.lib Tue Nov 03 15:17:16 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://os.mbed.com/users/johnAlexander/code/VL53L3_Lib/#316175f392f7
--- a/mbed-os.lib Tue Nov 03 15:17:16 2020 +0000 +++ b/mbed-os.lib Fri Apr 30 14:46:24 2021 +0000 @@ -1,1 +1,1 @@ -https://github.com/armmbed/mbed-os/#aa70f680bb5755e8fea3f93fc6e04d9b3de235bb +https://github.com/armmbed/mbed-os/#9738b27c7df897c29e9769911d6794ba3e5b3f19