Pedido antes de las 14:00 en día laborable = enviado el mismo día 30 días de desistimiento 1 año de garantía
← Volver al resumen

Al reproducirlo, se carga el vídeo de YouTube.

Esquema de conexión y ejemplo de código

Así conectas el TOF200C VL53L0X sensor de distancia Time-Of-Flight de alta precisión a un Arduino UNO o ESP32, con un sketch de ejemplo que puedes subir directamente.

Demo del sensor de distancia ToF VL53L0X

Este proyecto muestra mediciones de distancia en tiempo real usando el sensor Time-of-Flight VL53L0X conectado mediante I2C. El Arduino Uno lee los datos de distancia en milímetros del sensor y los imprime en el Serial Monitor cada 200 ms.

Esquema de conexión: TOF200C VL53L0X sensor de distancia Time-Of-Flight de alta precisión en un Arduino UNO
Esquema de conexión · Haz clic para ampliar
Tabla de conexión: TOF200C VL53L0X sensor de distancia Time-Of-Flight de alta precisión en un Arduino UNO
Tabla de conexión · Haz clic para ampliar
VL53L0X_ToF_Distance_Sensor_Demo.ino · compilado y probado
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL53L0X ToF Distance Sensor Demo
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : TOF200C VL53L0X Distance Sensor Time-Of-Flight high precision
 *  Libraries : Adafruit_VL53L0X 1.2.5
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include <Wire.h>
#include <Adafruit_VL53L0X.h>

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    delay(1);
  }

  Serial.println(F("VL53L0X Distance Sensor Test"));

  if (!lox.begin()) {
    Serial.println(F("Failed to initialize VL53L0X sensor! Check wiring."));
    while (1) {
      delay(10);
    }
  }

  Serial.println(F("Sensor initialized successfully. Reading distance..."));
}

void loop() {
  VL53L0X_RangingMeasurementData_t measure;

  lox.rangingTest(&measure, false); // Pass true to enable debug output

  if (measure.RangeStatus != 4) { // Phase failures are status 4
    Serial.print(F("Distance: "));
    Serial.print(measure.RangeMilliMeter);
    Serial.println(F(" mm"));
  } else {
    Serial.println(F("Target out of range"));
  }

  delay(200);
}

Bibliotecas necesarias: Adafruit_VL53L0X 1.2.5

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Sensor de distancia VL53L0X con ESP32

Este proyecto mide la distancia en milímetros usando el sensor Time-of-Flight VL53L0X conectado mediante I2C. Abre el Monitor Serie a 115200 baud para ver las mediciones de distancia en tiempo real.

Esquema de conexión: TOF200C VL53L0X sensor de distancia Time-Of-Flight de alta precisión en un ESP32 DevKit V1
Esquema de conexión · Haz clic para ampliar
Tabla de conexión: TOF200C VL53L0X sensor de distancia Time-Of-Flight de alta precisión en un ESP32 DevKit V1
Tabla de conexión · Haz clic para ampliar
VL53L0X_Distance_Sensor_with_ESP32.ino · compilado y probado
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL53L0X Distance Sensor with ESP32
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : TOF200C VL53L0X Distance Sensor Time-Of-Flight high precision
 *  Libraries : Adafruit_VL53L0X 1.2.5
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

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

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);
  while (!Serial) { delay(1); }

  Serial.println("VL53L0X Distance Sensor Test");

  // Initialize I2C communication (ESP32 default: SDA=21, SCL=22)
  Wire.begin(21, 22);

  if (!lox.begin()) {
    Serial.println(F("Failed to boot VL53L0X. Check wiring!"));
    while (1);
  }

  Serial.println(F("Sensor initialized successfully."));
}

void loop() {
  VL53L0X_RangingMeasurementData_t measure;

  lox.rangingTest(&measure, false); // Pass true to get debug data printout

  if (measure.RangeStatus != 4) {  // Phase failures have status 4
    Serial.print("Distance (mm): ");
    Serial.println(measure.RangeMilliMeter);
  } else {
    Serial.println("Out of range");
  }

  delay(250);
}

Bibliotecas necesarias: Adafruit_VL53L0X 1.2.5

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Vistos recientemente

Interruptor basculante ON/OFF redondo de 15 mm para montaje empotrado

Interruptor basculante ON/OFF redondo de 15 mm para montaje empotrado

€ 0,99
Terminal de altavoz con bornes de presión y resorte 2 polos

Terminal de altavoz con bornes de presión y resorte 2 polos

€ 2,49