Sample program for 3 sensors using polling in autonomous mode.
Dependencies: X_NUCLEO_53L1A2
Diff: main.cpp
- Revision:
- 8:ac303cd2d35f
- Parent:
- 7:242f30acc456
- Child:
- 10:2da1507fa8c2
--- a/main.cpp Fri May 21 08:38:45 2021 +0000 +++ b/main.cpp Fri May 21 08:48:52 2021 +0000 @@ -1,6 +1,6 @@ /* * This VL53L1CB Expansion board test application performs range measurements - * using the onboard embedded sensor, in interrupt mode. + * using the onboard embedded sensor, in polling mode. * Measured ranges are ouput on the Serial Port, running at 115200 baud. * * This is designed to work with MBed v2.x, & MBedOS v5.x / v6.x. @@ -123,7 +123,7 @@ return status; } - status = board->sensor_centre->start_measurement(&sensor_irq); + status = Sensor->vl53L1_StartMeasurement(); if (status != 0) { return status; } @@ -179,15 +179,16 @@ while (true) { pMultiRangingData = &MultiRangingData; - if (int_sensor) { - int_sensor = false; - status = board->sensor_centre->vl53L1_GetMultiRangingData( pMultiRangingData); + status = board->sensor_centre->vl53L1_WaitMeasurementDataReady(); +// if (int_sensor) { +// int_sensor = false; + status = board->sensor_centre->vl53L1_GetMultiRangingData( pMultiRangingData); - print_results( devCentre.i2c_slave_address, pMultiRangingData ); + print_results( devCentre.i2c_slave_address, pMultiRangingData ); - status = board->sensor_centre->VL53L1_ClearInterrupt(); - board->sensor_centre->enable_interrupt_measure_detection_irq(); - } + status = board->sensor_centre->VL53L1_ClearInterrupt(); +// board->sensor_centre->enable_interrupt_measure_detection_irq(); +// } } printf("Terminating.\n");