Skip to content

Commit 579fb32

Browse files
Added some content to the tutorial
1 parent 702f0c1 commit 579fb32

File tree

1 file changed

+19
-14
lines changed
  • content/hardware/05.nicla/boards/nicla-vision/tutorials/proximity

1 file changed

+19
-14
lines changed

content/hardware/05.nicla/boards/nicla-vision/tutorials/proximity/content.md

+19-14
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ software:
1616
- cli
1717
---
1818

19-
![Arduino Nicla Vision - Time of Flight sensor](assets/nicla-vision-tof.png)
19+
## Overview
2020

2121
In this tutorial you will use the Nicla Vision to detect proximity, thanks to the Time of Flight (ToF) sensor **VL53L1X**.
2222

23-
This tutorial contains the sketch to blink the built-in RGB LED and control the speed of its blink by the proximity values.
24-
This could help for future projects and control the Camera only when something is crossing in front of the board, like a proximity detector.
23+
This tutorial goes through how to create a sketch that will blink the built-in RGB LED and control the speed of its blink with the proximity values. It can be useful for future projects where there is a need to control the camera only when something is detected in front of the sensor.
2524

2625
***The Arduino sketch shown is available inside the `Arduino_Pro_Tutorials` library by going to `Examples > Nicla Vision > Proximity_Blink***
2726

@@ -31,20 +30,22 @@ The goals of this project are:
3130
- Learn how to interact with the proximity readings
3231
- Change the RGB values of the LED
3332

34-
3533
### Required Hardware and Software
3634

3735
* Arduino Nicla Vision
38-
* VL53L1X library (Available on the Library Manager)
36+
* VL53L1X library (Available in the Library Manager)
37+
38+
## Instructions
39+
40+
### Time of Flight Sensor
3941

40-
## Blink Depending on the Distance
42+
![Arduino Nicla Vision - Time of Flight sensor](assets/nicla-vision-tof.png)
4143

42-
Make sure you have installed the latest version of **Arduino mbed Core** and the **VL53L1X library**.
44+
To make sure that the sketch works properly, the latest versions of the **Arduino mbed Core** and the **VL53L1X library** needs to be installed. The **Arduino mbed Core** can be found in the **boards manager...** and the **VL53L1X library** can be found in the **Library manager**, both can be found inside the Arduino IDE.
4345

4446
### Include the Needed Libraries and Objects Declaration
4547

46-
First of all declare the sensor's class so you can access it later on your sketch.
47-
The variables are to avoid using delays as the reading would not be accurate.
48+
First of all declare the sensor's class so you can access it later on in your sketch. We use variables to control the time elements in the sketch. This will make sure that the readings stay accurate over time.
4849

4950
```cpp
5051
#include <Wire.h>
@@ -56,14 +57,13 @@ The variables are to avoid using delays as the reading would not be accurate.
5657
int timeStart = 0;
5758
int blinkTime = 2000;
5859
```
59-
***Make sure you set `Wire1` inside the VL53L1X constructor's parameter, it won't work if you don't add that setting***
60+
***Make sure you set `Wire1` inside the VL53L1X constructor's parameter, it won't work if you don't add this setting***
6061
6162
### Initialize the Proximity Sensor and the LED
6263
63-
Inside the setup you need to initialize the proximity sensor.
64-
Also the RGB LED needs to be set as an output to make it light up.
64+
Inside the setup you need to initialize and configure the proximity sensor. Also the RGB LED needs to be set as an output to make it light up and enable us to change its behavior.
6565
66-
***The LEDs are accessed as the Portenta H7: LEDR, LEDG and LEDB***
66+
***The LEDs are accessed in the same way as on the Portenta H7: LEDR, LEDG and LEDB***
6767
6868
```cpp
6969
void setup(){
@@ -86,7 +86,7 @@ Also the RGB LED needs to be set as an output to make it light up.
8686

8787
### Control the Speed of the Blink
8888

89-
The sketch is going to get the reading on every loop, store it and then the state of the LED will change until the time is up until the proximity reading.
89+
The sketch is going to get the reading on every loop, store it and then the state of the LED will change, until the time is up and another proximity reading is taken.
9090

9191
```cpp
9292
void loop(){
@@ -162,3 +162,8 @@ The sketch is going to get the reading on every loop, store it and then the stat
162162
| setTimeout(mSeconds) | Configure the milliseconds the sensor will wait in case it is not getting the proper reading to abort, and continue with a new one, 0 disables it. | `void` |
163163
| getTimeout() | Get the configured timeout value. | `uint16_t` |
164164
| timeoutOccurred() | Returns true whenever the sensor had a timeout. | `bool` |
165+
166+
167+
## Conclusion
168+
169+
In this tutorial we went through how to get readings from the ToF sensor. And how use these readings to change how the built-in LED behaves. At the end of the tutorial you can also find a reference list for the ToF library.

0 commit comments

Comments
 (0)