Simple HelloWorld program for the VL53L0X LIDAR sensor.
Dependencies: X_NUCLEO_53L0A1 mbed
Fork of HelloWorld_53L0A1 by
Diff: main.cpp
- Revision:
- 6:e59621ce59ea
- Parent:
- 4:c8932fb926d6
--- a/main.cpp Tue Dec 06 14:04:46 2016 +0000 +++ b/main.cpp Sun Apr 30 22:47:40 2017 +0000 @@ -11,6 +11,11 @@ static X_NUCLEO_53L0A1 *board=NULL; +//VIN -- VOUT +//GND -- GND +//SDA -- p27 +//SCA -- p28 + /*=================================== Main ================================== =============================================================================*/ int main() @@ -18,10 +23,10 @@ int status; uint32_t distance; - DevI2C *device_i2c =new DevI2C(VL53L0_I2C_SDA, VL53L0_I2C_SCL); + DevI2C *device_i2c =new DevI2C(p27, p28); /* creates the 53L0A1 expansion board singleton obj */ - board=X_NUCLEO_53L0A1::Instance(device_i2c, A2, D8, D2); + board=X_NUCLEO_53L0A1::Instance(device_i2c,p21,p21,p21); /* init the 53L0A1 expansion board with default values */ status=board->InitBoard(); @@ -31,7 +36,7 @@ { status = board->sensor_centre->GetDistance(&distance); if (status == VL53L0X_ERROR_NONE) - printf("Distance : %ld\n", distance); + printf("Distance : %ldmm\n", distance); } }