Distance measurement with the VL6180X
FunduinoLast updated on
Präzise Nahbereichsmessung mit dem Time-of-Flight-Sensor
You need this
VL6180X Abstandssensor - Time of Flight Laser, bis 10 cm, I2C
5,02 € *Item no. F23108551About the product — VL6180X Abstandssensor - Time of Flight Laser, bis 10 cm, I2C
Funduino UNO R3 Mikrocontroller - ATmega328P, 16 MHz, für Arduino
13,90 € *Item no. F23107480About the product — Funduino UNO R3 Mikrocontroller - ATmega328P, 16 MHz, für Arduino
Breadboard 830 Kontakte - Steckbrett für Arduino, lötfrei
2,90 € *Item no. FUN-1010553About the product — Breadboard 830 Kontakte - Steckbrett für Arduino, lötfrei
Breadboardkabel männlich-männlich - 40 Stück, 20 cm
1,74 € *Item no. FUN-1010558About the product — Breadboardkabel männlich-männlich - 40 Stück, 20 cm
All 4 parts together 23,56 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
The VL6180X sensor
Difference from other distance sensors
Connect the sensor
Install the library and output measured values
1 / 2
Display distance in the Serial Monitor
#include <Wire.h>
#include "Adafruit_VL6180X.h"
Adafruit_VL6180X vl = Adafruit_VL6180X();
void setup()
{
Serial.begin(115200);
while (!Serial) // Wait until the serial connection is established
{
delay(1); // This pause is repeated as long as the serial connection is not established.
}
vl.begin();
}
void loop()
{
uint8_t Entfernung = vl.readRange(); // The measured distance value is stored in "Entfernung".
uint8_t status = vl.readRangeStatus(); // The sensor status is read.
if (status == VL6180X_ERROR_NONE) { // If the sensor status contains no errors, the contents of the IF loop follow
Serial.print("Distance in mm: "); Serial.println(Entfernung); //Output the distance in the serial monitor
}
delay(100); // The delay keeps the values in the serial monitor easy to read. In applications for recording measurement data, such pauses should be avoided.
}Rate the instructions