Bonjours à tous,
J'ai fait fonctionner le capteur VL53L7CX sur un ESP8266 et je vous partage la procédure. Sachez que ces deux composant sont accessible via les liens qui suivent: VL53L7CX & ESP8266
Pour le câblage rien de plus simple:
Il faut connecter :
Coté capteur => Côté ESP
Vin => 5V,
GND => GND,
SDA => D2
SCL => D1
Ensuite j'ai installé cette librairie : librairie
Effectivement elle n'est pas pour le VL53L7CX mais elle est compatible.
Ensuite il faut que vous modifiez:
Tools →Non-32 Bit Access → Very Slow
Une fois que cela est fait essayé ce code:
/*
Read an 8x8 array of distances from the VL53L5CX
By: Nathan Seidle
SparkFun Electronics
Date: October 26, 2021
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
This example shows how to read all 64 distance readings at once.
Feel like supporting our work? Buy a board from SparkFun!
https://www.sparkfun.com/products/18642
*/
#include <Wire.h>
#include <SparkFun_VL53L5CX_Library.h> //http://librarymanager/All#SparkFun_VL53L5CX
SparkFun_VL53L5CX myImager;
VL53L5CX_ResultsData measurementData; // Result data class structure, 1356 byes of RAM
int imageResolution = 0; //Used to pretty print output
int imageWidth = 0; //Used to pretty print output
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println("SparkFun VL53L5CX Imager Example");
Wire.begin(); //This resets to 100kHz I2C
Wire.setClock(400000); //Sensor has max I2C freq of 400kHz
Serial.println("Initializing sensor board. This can take up to 10s. Please wait.");
ESP.wdtDisable();
if (myImager.begin() == false)
{
Serial.println(F("Sensor not found - check your wiring. Freezing"));
while (1) ;
}
ESP.wdtEnable(3000);
myImager.setResolution(8*8); //Enable all 64 pads
imageResolution = myImager.getResolution(); //Query sensor for current resolution - either 4x4 or 8x8
imageWidth = sqrt(imageResolution); //Calculate printing width
myImager.startRanging();
}
void loop()
{
//Poll sensor for new data
if (myImager.isDataReady() == true)
{
if (myImager.getRangingData(&measurementData)) //Read distance data into array
{
//The ST library returns the data transposed from zone mapping shown in datasheet
//Pretty-print data with increasing y, decreasing x to reflect reality
for (int y = 0 ; y <= imageWidth * (imageWidth - 1) ; y += imageWidth)
{
for (int x = imageWidth - 1 ; x >= 0 ; x--)
{
Serial.print("\t");
Serial.print(measurementData.distance_mm[x + y]);
}
Serial.println();
}
Serial.println();
}
}
delay(5); //Small delay between polling
}
Si tout c'est bien passé vous devriez avoir réussit à obtenir vos 64 points de print dans votre moniteur série.












