You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-6Lines changed: 34 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,22 +13,22 @@ Please see [CONTRIBUTING.md](CONTRIBUTING.md)
13
13
## Future Features
14
14
- C++ object-oriented library
15
15
- Easy way to configure defaults passed into initialization functions
16
-
17
-
18
-
# Usage
19
-
To use this library in your own project, include the `VL53L1X_pico_api` directory in your CMake script (e.g. `add_subdirectory(VL53L1X_pico_api)`). Then, include the needed headers as specified below, and add `VL53L1X_pico_api` to the `target_link_libraries` for your project. Running `cmake` for your project should then include and compile this API as needed.
16
+
- Thread worker
20
17
21
18
# Examples
22
-
To build the project, first clone the code and then run the following:
19
+
To build the examples for the project, first clone the code and then run the following:
23
20
```
21
+
cd examples
24
22
mkdir build
25
23
cd build
26
24
cmake ..
27
25
make
28
26
```
29
27
Note: if you have a Pico W, append `-DPICO_BOARD=pico_w` to the `cmake` command.
30
28
31
-
This will build the example code. The resulting uf2 file in the `build/examples/continuous_measurement` can be uploaded to a Pico/Pico W. This example shows how to initialize and use the VL53L1X sensor to continously measure. The sensor must be attached to the following pins:
29
+
This will build the example code. Either of th resulting `uf2` files in `build/examples/continuous_measurement` and `build/examples/sampling` can be uploaded to a Pico/Pico W. The former will continously print the sensor reading to stdout (over USB), whereas the second only prints samples when input is recieved from stdin (also over USB). To use these, leave your Pico connected to your computer after uploading the `uf2` file, and open a USB serial connection to it (for example, using Putty on Windows or native tools on UNIX-based systems).
30
+
31
+
For the examples to work correctly, the sensor must be attached to the following pins:
32
32
33
33
| VL53L1X | Pico |
34
34
| ------ | ----- |
@@ -39,6 +39,34 @@ This will build the example code. The resulting uf2 file in the `build/examples/
39
39
| SDA | GPIO5 |
40
40
| XSHUT | Unconnected (Used to reset device)|
41
41
42
+
# Installation
43
+
To use/install this library in your own project, acquire a copy of this repo in your project (such as using `git submodule`), and then make the following modifications to your project's `CMakeLists.txt`:
44
+
45
+
If your project structure is something like this:
46
+
```root/ (for your project)
47
+
yourapp.h
48
+
yourapp.c
49
+
CMakeLists.txt
50
+
build/
51
+
...
52
+
VL53L1X-C-API-Pico/
53
+
library/
54
+
import.cmake
55
+
...
56
+
...
57
+
```
58
+
Then, add this line to your `CMakeLists.txt` file before defining/linking your executables (e.g. building `yourapp`):
Then, to link `<your executable>` with libraries you already have (`<your libraries>`) and this VL53L1X library, change the `target_link_libraries` line for `<your executable>` as follows:
64
+
```
65
+
target_link_libraries(<your executable> PUBLIC pico_stdlib hardware_i2c VL53L1X_pico_api <your libraries> )
66
+
```
67
+
68
+
Running `cmake` for your project will now include and compile this API.
69
+
42
70
# Documentation
43
71
The header files all have extensive documentation on the purpose of each function, which can be supplemented by the *STMicroelectronics VL53L1X Ultra Lite Driver User Manual (UM2510)*.
0 commit comments