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_53L0A1 mbed
Fork of HelloWorld_53L0A1 by
main.cpp
00001 #include "mbed.h" 00002 #include "XNucleo53L0A1.h" 00003 #include <stdio.h> 00004 00005 /* This VL53L0X Expansion board test application performs a range measurement in polling mode 00006 on the onboard embedded top sensor. */ 00007 00008 #define VL53L0_I2C_SDA D14 00009 #define VL53L0_I2C_SCL D15 00010 00011 static XNucleo53L0A1 *board=NULL; 00012 00013 00014 /*=================================== Main ================================== 00015 =============================================================================*/ 00016 int main() 00017 { 00018 int status; 00019 uint32_t distance; 00020 00021 DevI2C *device_i2c = new DevI2C(VL53L0_I2C_SDA, VL53L0_I2C_SCL); 00022 00023 /* creates the 53L0A1 expansion board singleton obj */ 00024 board = XNucleo53L0A1::instance(device_i2c, A2, D8, D2); 00025 00026 /* init the 53L0A1 expansion board with default values */ 00027 status = board->init_board(); 00028 if (status) { 00029 printf("Failed to init board!\r\n"); 00030 return 0; 00031 } 00032 00033 while (1) { 00034 status = board->sensor_centre->get_distance(&distance); 00035 if (status == VL53L0X_ERROR_NONE) { 00036 printf("Distance : %ld\r\n", distance); 00037 } 00038 } 00039 }
Generated on Thu Jul 14 2022 12:03:48 by
1.7.2

X-NUCLEO-53L0A1 Ranging Sensor Expansion Board