Das TOF200C-Modul verwendet den ST VL53L0X Time-of-Flight-Laser-Abstandssensor, um Entfernungen zu messen, indem das reflektierte Licht zeitlich erfasst wird. Es wird typischerweise über einen I2C-Bus angebunden, damit Mikrocontroller wie Arduino oder ESP32 es auslesen können.
| Pin | Signal | Beschreibung |
|---|---|---|
VIN |
power | Module power input for the VL53L0X board, typically supplied from 3.3–5V depending on module regulator. |
GND |
ground | Ground reference for power and I2C signals. |
SDA |
SDA | I2C data line for reading distance measurements from the VL53L0X. |
SCL |
SCL | I2C clock line driven by the host controller for VL53L0X communication. |
INT |
interrupt | Interrupt output from the VL53L0X, used to signal measurement/data-ready events. |
SHUT |
enable | Shutdown/reset control input for the VL53L0X; drive low to disable or reset the sensor. |
| Von | Nach | Kabel |
|---|---|---|
board:5V |
x1:VIN |
red |
board:GND |
x1:GND |
black |
board:A4 |
x1:SDA |
green |
board:A5 |
x1:SCL |
blue |
Dieses Beispiel wurde für das arduino-uno geschrieben und kompiliergeprüft. Codey Online passt es für jedes andere unterstützte Board an.
#include <Wire.h>
#include <Adafruit_VL53L0X.h>
Adafruit_VL53L0X lox;
VL53L0X_RangingMeasurementData_t measure;
void setup() {
Serial.begin(115200);
while (!Serial) {
;
}
Wire.begin();
Serial.println("Adafruit VL53L0X distance sensor example");
if (!lox.begin()) {
Serial.println("Failed to boot VL53L0X. Check wiring.");
while (1) {
delay(10);
}
}
Serial.println("VL53L0X ready.");
}
void loop() {
lox.rangingTest(&measure, false);
if (measure.RangeStatus != 4) {
Serial.print("Distance: ");
Serial.print(measure.RangeMilliMeter);
Serial.println(" mm");
} else {
Serial.println("Out of range");
}
delay(200);
}
Beschreib einfach, was du bauen willst. Codey Online schreibt den Code, zeichnet den Schaltplan, kompiliert alles und flasht dein Board direkt aus dem Browser.
Kostenlos starten