Le VL53L0X est un capteur de distance parfait pour détecter un mouvement et mesurer une distance pouvant aller de 30mm à 1,2m avec une précision de 5%.
Il contient une source laser miniature invisible, et un capteur de réception.
Alimentation 3 à 5V
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
// VL53L0X IC IIC I2C Interface Série Capteur Breakout Capteur Module Laser Allant Conseil Distance Temps-de-Vol ToF GY-VL53L0XV2 // https://fr.aliexpress.com/item/VL53L0X-IC-IIC-I2C-Sensor-Breakout-Sensor-Module-Laser-Ranging-Distance-Module-Time-of-Flight-ToF/32789136788.html?spm=a2g0s.9042311.0.0.40696c37C21rVV #include "Adafruit_VL53L0X.h" Adafruit_VL53L0X lox = Adafruit_VL53L0X(); void setup() { Serial.begin(115200); // wait until serial port opens for native USB devices while (! Serial) { delay(1); } Serial.println("Adafruit VL53L0X test"); if (!lox.begin()) { Serial.println(F("Failed to boot VL53L0X")); while(1); } // power Serial.println(F("VL53L0X API Simple Ranging example\n\n")); } void loop() { VL53L0X_RangingMeasurementData_t measure; Serial.print("Reading a measurement... "); lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout! if (measure.RangeStatus != 4) { // phase failures have incorrect data Serial.print("Distance: "); Serial.print(measure.RangeMilliMeter);Serial.println(" mm"); } else { Serial.println(" out of range "); } delay(100); } |