Has anyone been able to get the VL53L1X to work on an ESP device?
i am Trying to connect VL53L1X and ESP8266 and having the following output,
my code is :
#include <ComponentObject.h>
#include <RangeSensor.h>
#include <SparkFun_VL53L1X.h>
#include <vl53l1x_class.h>
#include <vl53l1_error_codes.h>
#include <Wire.h>
#include "SparkFun_VL53L1X.h"
SFEVL53L1X distanceSensor;
void setup(void)
{
Serial.begin(115200);
pinMode(0, OUTPUT);
pinMode(2, OUTPUT);
pinMode(12, OUTPUT);
pinMode(14, OUTPUT);
digitalWrite(0, HIGH);
digitalWrite(2, LOW);
digitalWrite(12, LOW);
digitalWrite(14, LOW);
Wire.begin(4,5);
if (distanceSensor.begin() == 0) //Begin returns 0 on a good init
{
Serial.println("Sensor online!");
}
}
void loop(void)
{
digitalWrite(0, HIGH);
distanceSensor.startRanging(); //Write configuration bytes to initiate measurement
int distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor
distanceSensor.stopRanging();
Serial.print("Sensor ");
Serial.print(1);
Serial.print(" Distance(mm): ");
Serial.print(distance);
Serial.print(" ");
digitalWrite(0, LOW);
delay(100);
digitalWrite(2, HIGH);
distanceSensor.startRanging(); //Write configuration bytes to initiate measurement
distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor
distanceSensor.stopRanging();
Serial.print("Sensor ");
Serial.print(2);
Serial.print(" Distance(mm): ");
Serial.print(distance);
Serial.print(" ");
digitalWrite(2, LOW);
delay(100);
digitalWrite(12, HIGH);
distanceSensor.startRanging(); //Write configuration bytes to initiate measurement
distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor
distanceSensor.stopRanging();
Serial.print("Sensor ");
Serial.print(3);
Serial.print(" Distance(mm): ");
Serial.print(distance);
Serial.print(" ");
digitalWrite(12, LOW);
delay(100);
digitalWrite(14, HIGH);
distanceSensor.startRanging(); //Write configuration bytes to initiate measurement
distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor
distanceSensor.stopRanging();
Serial.print("Sensor ");
Serial.print(4);
Serial.print(" Distance(mm): ");
Serial.print(distance);
Serial.print(" ");
digitalWrite(14, LOW);
delay(100);
Serial.println();
delay(1000);
}