Page 1 of 1

ESP32-CAM With VL53L1X Distance Sensor

Posted: Sun Apr 18, 2021 6:16 am
by jcdrbre4
Has anyone got the combination of the ESP32-CAM and VL53L1X to work?

I'm trying to re-define the I2C pins to 14 and 15 but with no success using the SparkFun_VL53L1X.h library. Is it possible to redefine the SDA and SCL pins using this library?

Here are the relevant parts of my code:

Code: Select all

#include <Wire.h>
#include "SparkFun_VL53L1X.h"

SFEVL53L1X distanceSensor;

const int I2C_SDA = 14;
const int I2C_SCL = 15;

void setup() {

  Wire.begin(I2C_SDA,I2C_SCL);

  distanceSensor.setDistanceModeShort();

}

void loop() {

  distanceSensor.startRanging();
  int distance = distanceSensor.getDistance();
  distanceSensor.stopRanging();

  debugV("Distance (mm) %u",distance);

}