unable to find headers
Posted: Mon Jul 17, 2023 1:58 am
Hi,
I'm new to ESP32s and am working with Arduino IDE 2.1.1 and a WROVER ESP32.
I want to get the VL53L5CX-SATEL to work with it. I've connected it to the I2C pins but am struggling with getting the code working.
I connected
SCL to pin 22, SDA to pin 21, PWREN, AVDD & IOVDD to 3.3V and GND to GND
I tried the following code:
but keep seeing "Failed to initialize sensor!" on the Serial Monitor. What could be the problem here?
Thank you!
I'm new to ESP32s and am working with Arduino IDE 2.1.1 and a WROVER ESP32.
I want to get the VL53L5CX-SATEL to work with it. I've connected it to the I2C pins but am struggling with getting the code working.
I connected
SCL to pin 22, SDA to pin 21, PWREN, AVDD & IOVDD to 3.3V and GND to GND
I tried the following code:
Code: Select all
#include <Wire.h>
#include <Adafruit_VL53L0X.h>
#define SDA_PIN 21
#define SCL_PIN 22
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
void setup() {
Wire.begin(SDA_PIN, SCL_PIN);
Serial.begin(115200);
if (!lox.begin()) {
Serial.println("Failed to initialize sensor!");
while (1);
}
// Optional: Change the measurement timing budget if needed
// lox.setMeasurementTimingBudget(20000);
}
void loop() {
VL53L0X_RangingMeasurementData_t measurement;
Serial.print("test");
if (lox.rangingTest(&measurement, false)) {
if (measurement.RangeStatus != 4) {
Serial.print("Distance: ");
Serial.print(measurement.RangeMilliMeter);
Serial.println(" mm");
} else {
Serial.println("Out of range");
}
} else {
Serial.println("Failed to perform ranging measurement!");
}
delay(100);
}
Thank you!