Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 3:42c96c9c627b
- Parent:
- 2:86876e590f28
- Child:
- 4:360dc34c3769
--- a/main.cpp Mon Oct 19 09:01:48 2020 +0000 +++ b/main.cpp Tue May 04 09:39:21 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. @@ -11,11 +11,11 @@ //Main_interrupt_ranging.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_SDA D14 @@ -23,8 +23,13 @@ #define MEASUREMENTTIMING 55 -static XNucleo53LX *board=NULL; -Serial pc(SERIAL_TX, SERIAL_RX); +static XNucleo53L3A2 *board=NULL; +#if (MBED_VERSION > 60300) + UnbufferedSerial pc(USBTX, USBRX); + extern "C" void wait_ms(int ms); +#else + Serial pc(SERIAL_TX, SERIAL_RX); +#endif static int int_centre_result = 0; static int int_left_result = 0; @@ -104,7 +109,7 @@ int main() { int status; - VL53LX * Sensor; + VL53L3 * Sensor; uint16_t wordData; uint8_t ToFSensor = 1; // 0=Left, 1=Center(default), 2=Right @@ -122,7 +127,7 @@ // printf("I2C device created! %d %d\r\n",dev_I2C,*dev_I2C); /* 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"); /* init the 53L1A1 expansion board with default values */ @@ -335,4 +340,11 @@ } printf("terminated"); } + +#if (MBED_VERSION > 60300) +extern "C" void wait_ms(int ms) + { + thread_sleep_for(ms); + } +#endif \ No newline at end of file