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 "x_nucleo_53l0a1.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 X_NUCLEO_53L0A1 *board=NULL; 00012 00013 00014 //VIN -- VOUT 00015 //GND -- GND 00016 //SDA -- p27 00017 //SCA -- p28 00018 00019 /*=================================== Main ================================== 00020 =============================================================================*/ 00021 int main() 00022 { 00023 int status; 00024 uint32_t distance; 00025 00026 DevI2C *device_i2c =new DevI2C(p27, p28); 00027 00028 /* creates the 53L0A1 expansion board singleton obj */ 00029 board=X_NUCLEO_53L0A1::Instance(device_i2c,p21,p21,p21); 00030 00031 /* init the 53L0A1 expansion board with default values */ 00032 status=board->InitBoard(); 00033 if(status) { printf("Failed to init board!\n\r"); return 0; } 00034 00035 while(1) 00036 { 00037 status = board->sensor_centre->GetDistance(&distance); 00038 if (status == VL53L0X_ERROR_NONE) 00039 printf("Distance : %ldmm\n", distance); 00040 } 00041 00042 } 00043
Generated on Fri Jul 15 2022 06:57:06 by
1.7.2
