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: content/hardware/05.nicla/boards/nicla-vision/tutorials/proximity/content.md
+40-40
Original file line number
Diff line number
Diff line change
@@ -48,14 +48,14 @@ To make sure that the sketch works properly, the latest versions of the **Arduin
48
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.
49
49
50
50
```cpp
51
-
#include<Wire.h>
52
-
#include"VL53L1X.h"
53
-
VL53L1X proximity(Wire1);
54
-
55
-
bool blinkState = false;
56
-
int reading = 0;
57
-
int timeStart = 0;
58
-
int blinkTime = 2000;
51
+
#include<Wire.h>
52
+
#include"VL53L1X.h"
53
+
VL53L1X proximity(Wire1);
54
+
55
+
bool blinkState = false;
56
+
int reading = 0;
57
+
int timeStart = 0;
58
+
int blinkTime = 2000;
59
59
```
60
60
***Make sure you set `Wire1` inside the VL53L1X constructor's parameter, it won't work if you don't add this setting***
61
61
@@ -105,43 +105,43 @@ The sketch is going to get the reading on every loop, store it and then the stat
105
105
### Complete Sketch
106
106
107
107
```cpp
108
-
#include <Wire.h>
109
-
#include "VL53L1X.h"
110
-
VL53L1X proximity(Wire1);
111
-
112
-
bool blinkState = false;
113
-
int reading = 0;
114
-
int timeStart = 0;
115
-
int blinkTime = 2000;
116
-
117
-
void setup(){
118
-
Serial.begin(115200);
119
-
Wire1.begin();
120
-
121
-
pinMode(LEDB,OUTPUT);
122
-
digitalWrite(LEDB, blinkState);
123
-
124
-
if (!proximity.init()){
125
-
Serial.println("Failed to detect and initialize sensor!");
126
-
while (1);
127
-
}
128
-
129
-
proximity.setDistanceMode(VL53L1X::Long);
130
-
proximity.setMeasurementTimingBudget(10000);
131
-
proximity.startContinuous(10);
108
+
#include <Wire.h>
109
+
#include "VL53L1X.h"
110
+
VL53L1X proximity(Wire1);
111
+
112
+
bool blinkState = false;
113
+
int reading = 0;
114
+
int timeStart = 0;
115
+
int blinkTime = 2000;
116
+
117
+
void setup(){
118
+
Serial.begin(115200);
119
+
Wire1.begin();
120
+
121
+
pinMode(LEDB,OUTPUT);
122
+
digitalWrite(LEDB, blinkState);
123
+
124
+
if (!proximity.init()){
125
+
Serial.println("Failed to detect and initialize sensor!");
0 commit comments