![](/media/cache/group/HuMVe-1_logo.png.50x50_q85.png)
Second demo with X-NUCLEO-53L1A1.
Dependencies: X_NUCLEO_53L1A1 X_NUCLEO_IKS01A3
Diff: main.cpp
- Revision:
- 6:054c18d427bf
- Parent:
- 5:7f6149b9cbbe
- Child:
- 11:da3c8e9bf1f9
--- a/main.cpp Tue Nov 23 09:00:33 2021 +0000 +++ b/main.cpp Tue Nov 23 16:33:58 2021 +0000 @@ -8,7 +8,7 @@ * This VL53L1X Expansion board test application performs range measurements * using the onboard embedded centre sensor, and 2 Satellite boards. * - * Measured ranges are ouput on the Serial Port, running at 115200 baud. + * Measured ranges are ouput on the Serial Port, running at 9600 baud. * * The Black Reset button is used to restart the program. * @@ -38,14 +38,13 @@ #define VL53L1_I2C_SDA D14 #define VL53L1_I2C_SCL D15 +#define DISPLAY_CENTRE false +#define DISPLAY_LEFT true +#define DISPLAY_RIGHT false + static XNucleo53L1A1 *board=NULL; -volatile bool polling_stop = false; -void stop_polling(void) -{ - polling_stop = true; -} /*=================================== Main ================================== =============================================================================*/ @@ -111,11 +110,6 @@ */ while (1) { - if (polling_stop) - { - printf("\r\nEnding loop mode \r\n"); - break; - } if (board->sensor_centre != NULL) { board->sensor_centre->vl53l1x_check_for_data_ready(&ready_centre); } @@ -137,19 +131,21 @@ board->sensor_right->vl53l1x_get_range_status(&ready_right); board->sensor_right->vl53l1x_get_distance(&distance_right); } - + #if DISPLAY_CENTRE if (board->sensor_centre != NULL) { - printf("Distance read by centre sensor is : %d\r\n", distance_centre); + printf("Distance read by centre sensor is : %d mm\r\n", distance_centre); } - + #endif + #if DISPLAY_LEFT if (board->sensor_left != NULL) { - printf("Distance read by left satellite sensor is : %d\r\n", distance_left); + printf("Distance read by left satellite sensor is : %d mm\r\n", distance_left); } - + #endif + #if DISPLAY_RIGHT if (board->sensor_right != NULL) { - printf("Distance read by right satellite sensor is : %d\r\n", distance_right); + printf("Distance read by right satellite sensor is : %d mm\r\n", distance_right); } - + #endif } return status;