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.
Dependencies: X_NUCLEO_53L1A1_mbed
Diff: main.cpp
- Revision:
- 3:a3a863902994
- Parent:
- 2:819f8323b02d
diff -r 819f8323b02d -r a3a863902994 main.cpp
--- a/main.cpp Mon Oct 14 10:02:40 2019 +0000
+++ b/main.cpp Mon Oct 14 10:12:25 2019 +0000
@@ -1,6 +1,6 @@
/*
* This VL53L1X Expansion board test application performs range measurements
- * using the onboard embedded centre sensor, and 2 Satellite boards.
+ * using the onboard embedded centre sensor.
*
* Measured ranges are ouput on the Serial Port, running at 115200 baud.
*
@@ -47,11 +47,7 @@
{
int status = 0;
uint8_t ready_centre = 0;
- uint8_t ready_left = 0;
- uint8_t ready_right = 0;
uint16_t distance_centre = 0;
- uint16_t distance_left = 0;
- uint16_t distance_right = 0;
printf("Hello world!\r\n");
@@ -81,24 +77,6 @@
}
}
- /* Start ranging on the left sensor */
- if (board->sensor_left != NULL) {
- status = board->sensor_left->VL53L1X_StartRanging();
- if (status != 0) {
- printf("Left sensor failed to start ranging!\r\n");
- return status;
- }
- }
-
- /* Start ranging on the right sensor */
- if (board->sensor_right != NULL) {
- status = board->sensor_right->VL53L1X_StartRanging();
- if (status != 0) {
- printf("Right sensor failed to start ranging!\r\n");
- return status;
- }
- }
-
/* Ranging loop
* Checks each sensor for data ready
*/
@@ -112,33 +90,13 @@
if (board->sensor_centre != NULL) {
board->sensor_centre->VL53L1X_CheckForDataReady(&ready_centre);
}
- if (board->sensor_left != NULL) {
- board->sensor_left->VL53L1X_CheckForDataReady(&ready_left);
- }
- if (board->sensor_right != NULL) {
- board->sensor_right->VL53L1X_CheckForDataReady(&ready_right);
- }
if (ready_centre) {
board->sensor_centre->VL53L1X_GetRangeStatus(&ready_centre);
board->sensor_centre->VL53L1X_GetDistance(&distance_centre);
}
- if (ready_left) {
- board->sensor_left->VL53L1X_GetRangeStatus(&ready_left);
- board->sensor_left->VL53L1X_GetDistance(&distance_left);
- }
- if (ready_right) {
- board->sensor_right->VL53L1X_GetRangeStatus(&ready_right);
- board->sensor_right->VL53L1X_GetDistance(&distance_right);
- }
if (board->sensor_centre != NULL) {
- printf("Distance read by centre sensor is : %d\r\n", distance_centre);
- }
- if (board->sensor_left != NULL) {
- printf("Distance read by left satellite sensor is : %d\r\n", distance_left);
- }
- if (board->sensor_right != NULL) {
- printf("Distance read by right satellite sensor is : %d\r\n", distance_right);
+ printf("Distance read by sensor is : %d\r\n", distance_centre);
}
}