Bestilt før kl. 14.00 på hverdage = afsendt samme dag 30 dages fortrydelsesret 1 års garanti
← Terug til oversigten

Ved afspilning indlæses videoen fra YouTube.

Tilslutningsdiagram og kodeeksempel

Sådan tilslutter du TOF050C-VL6180X Afstandssensor Time-Of-Flight meget præcis til en Arduino UNO eller ESP32, med en eksempelsketch, du kan uploade med det samme.

VL6180X-afstandssensormåling

Dette projekt måler præcise kortdistanceafstande (op til ~200mm) med VL6180X Time-of-Flight-sensoren via I2C. Tilslut sensoren til strøm- og I2C-benene, og åbn derefter Serial Monitor ved 115200 baud for at se afstandsmålingerne i millimeter i realtid.

Tilslutningsdiagram: TOF050C-VL6180X Afstandssensor Time-Of-Flight meget præcis på en Arduino UNO
Tilslutningsdiagram · Klik for at forstørre
Tilslutningstabel: TOF050C-VL6180X Afstandssensor Time-Of-Flight meget præcis på en Arduino UNO
Tilslutningstabel · Klik for at forstørre
VL6180X_Distance_Sensor_Measurement.ino · kompileret og testet
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL6180X Distance Sensor Measurement
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : TOF050C-VL6180X Distance Sensor Time-Of-Flight high precision
 *  Libraries : Adafruit_VL6180X 1.4.4
 *
 *  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_VL6180X.h>

Adafruit_VL6180X vl = Adafruit_VL6180X();

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

  Serial.println(F("Initializing VL6180X sensor..."));
  if (!vl.begin()) {
    Serial.println(F("Failed to find VL6180X sensor! Check wiring."));
    while (1);
  }
  Serial.println(F("VL6180X sensor ready!"));
}

void loop() {
  uint8_t range = vl.readRange();
  uint8_t status = vl.readRangeStatus();

  if (status == VL6180X_ERROR_NONE) {
    Serial.print(F("Distance: "));
    Serial.print(range);
    Serial.println(F(" mm"));
  } else {
    if (status >= VL6180X_ERROR_SYSERR_1 && status <= VL6180X_ERROR_SYSERR_5) {
      Serial.println(F("System error"));
    } else if (status == VL6180X_ERROR_ECEFAIL) {
      Serial.println(F("ECE failure"));
    } else if (status == VL6180X_ERROR_NOCONVERGE) {
      Serial.println(F("No convergence"));
    } else if (status == VL6180X_ERROR_RANGEIGNORE) {
      Serial.println(F("Ignoring range"));
    } else if (status == VL6180X_ERROR_SNR) {
      Serial.println(F("Signal-to-Noise Ratio error"));
    } else if (status == VL6180X_ERROR_RAWUFLOW) {
      Serial.println(F("Raw reading underflow"));
    } else if (status == VL6180X_ERROR_RAWOFLOW) {
      Serial.println(F("Raw reading overflow"));
    } else if (status == VL6180X_ERROR_RANGEUFLOW) {
      Serial.println(F("Range reading underflow"));
    } else if (status == VL6180X_ERROR_RANGEOFLOW) {
      Serial.println(F("Out of range (>200mm)"));
    }
  }

  delay(200);
}

Nødvendige biblioteker: Adafruit_VL6180X 1.4.4

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

VL6180X afstands- og lyssensor med ESP32

Dette projekt måler kort afstand (0–100 mm) og niveauet af omgivende lys ved hjælp af TOF050C VL6180X Time-of-Flight-sensoren via I2C. Tilslut sensoren direkte til ESP32'ens 3.3V og standard I2C-ben (GPIO 21 og 22). Åbn Serial Monitor ved 115200 baud for at se afstands- og omgivende lux-målinger i realtid.

Tilslutningsdiagram: TOF050C-VL6180X Afstandssensor Time-Of-Flight meget præcis på en ESP32 DevKit V1
Tilslutningsdiagram · Klik for at forstørre
Tilslutningstabel: TOF050C-VL6180X Afstandssensor Time-Of-Flight meget præcis på en ESP32 DevKit V1
Tilslutningstabel · Klik for at forstørre
VL6180X_Distance_Light_Sensor_with_ESP32.ino · kompileret og testet
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : VL6180X Distance & Light Sensor with ESP32
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : TOF050C-VL6180X Distance Sensor Time-Of-Flight high precision
 *  Libraries : Adafruit_VL6180X 1.4.4
 *
 *  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_VL6180X.h>

Adafruit_VL6180X vl = Adafruit_VL6180X();

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

  Serial.println("VL6180X Distance & Light Sensor Demo");

  Wire.begin(21, 22);

  if (!vl.begin()) {
    Serial.println("Failed to find VL6180X sensor! Check wiring.");
    while (1) delay(100);
  }

  Serial.println("VL6180X found and initialized!");
}

void loop() {
  float lux = vl.readLux(VL6180X_ALS_GAIN_5);
  uint8_t range = vl.readRange();
  uint8_t status = vl.readRangeStatus();

  Serial.print("Ambient Light: ");
  Serial.print(lux);
  Serial.print(" Lux | ");

  if (status == VL6180X_ERROR_NONE) {
    Serial.print("Distance: ");
    Serial.print(range);
    Serial.println(" mm");
  } else {
    Serial.print("Range Status Error (Code: ");
    Serial.print(status);
    Serial.println(")");
  }

  delay(200);
}

Nødvendige biblioteker: Adafruit_VL6180X 1.4.4

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

Set for nylig

1P Dupont plastikhus pin connector 2.54mm

1P Dupont plastikhus pin connector 2.54mm

€ 0,15
9P Dupont Plastikhus Pin Connector 2.54mm

9P Dupont Plastikhus Pin Connector 2.54mm

€ 0,25
6P Dupont plastikhus pin connector 2.54mm

6P Dupont plastikhus pin connector 2.54mm

€ 0,20
TOF400C-VL53L1X Afstandssensor Time-Of-Flight 4-400cm

TOF400C-VL53L1X Afstandssensor Time-Of-Flight 4-400cm

€ 18,15
10x Dupont stik Female 2.54mm

10x Dupont stik Female 2.54mm

€ 1,00