https://github.com/yspreen/vl53l0x-driver-pico-sdk-cpp
VL53L0X driver for the raspberry pico sdk in cpp
https://github.com/yspreen/vl53l0x-driver-pico-sdk-cpp
Last synced: 5 months ago
JSON representation
VL53L0X driver for the raspberry pico sdk in cpp
- Host: GitHub
- URL: https://github.com/yspreen/vl53l0x-driver-pico-sdk-cpp
- Owner: yspreen
- License: other
- Created: 2023-12-07T17:40:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-21T15:10:48.000Z (over 1 year ago)
- Last Synced: 2025-03-21T16:25:05.965Z (over 1 year ago)
- Language: C++
- Size: 10.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# VL53L0X driver for the raspberry pico sdk in cpp
adapted from the arduino version @ [pololu/vl53l0x-arduino](https://github.com/pololu/vl53l0x-arduino)
## Usage
```cpp
#include "VL53L0X.h"
#define I2C_SDA 8
#define I2C_SCL 9
// ...
// Initialize I2C0 at 400kHz
i2c_init(i2c0, 400 * 1000);
gpio_set_function(I2C_SDA, GPIO_FUNC_I2C);
gpio_set_function(I2C_SCL, GPIO_FUNC_I2C);
gpio_pull_up(I2C_SDA);
gpio_pull_up(I2C_SCL);
// Initialize VL53L0X sensor
VL53L0X sensor;
sensor.init();
sensor.setTimeout(500);
// Start continuous back-to-back mode (take readings as fast as possible)
sensor.startContinuous();
// ...
printf("millimeters: %d", sensor.readRangeContinuousMillimeters());
```