Distance Sensor C++ API

distancesensor
cpp

#1

The distance sensor is working from the Python examples, but I couldn’t find out how to connect to it from C++. I started from the GoPiGo3 i2c.c example, but don’t know how to setup the connection (address etc.). I keep getting error 4 (GROVE_STATUS_I2C_ERROR?). Is there an example available on how to access the GoPiGo distance sensor via the C++ API?


#2

Hi @smitsch,

There’s no support for the Distance Sensor in C++ yet, so you’d have to create your own set of source files in C++ for interfacing with the Distance Sensor.

The Distance Sensor is based on the VL53L0X chip, so you can easily find a couple of C++ libraries on the web with which you can already start with. You’ll be able to find the code for multiple platforms, so scarcity isn’t going to be a problem.

Here’s a library in C++ for the RaspberryPi that’s used for interfacing with the VL53L0X chip (aka the Distance Sensor):

Thank you!