###### tags: `Arduino` `Lcd` `I2C` `VL53L0X`
# VL53L0X with GY-53 distance sensor

* pinout
|borad type| Vin | GND | SCL | SDA |
|---| --- | --- | --- | --- |
|Mega2560|5V|GND|D21|D20|
|Uno|5V|GND|A5|A4|
```cpp=
/* This example shows how to use continuous mode to take
range measurements with the VL53L0X. It is based on
vl53l0x_ContinuousRanging_Example.c from the VL53L0X API.
The range readings are in units of mm. */
#include <Wire.h>
#include <VL53L0X.h>
VL53L0X sensor;
void setup()
{
Serial.begin(9600);
Wire.begin();
sensor.setTimeout(500);
if (!sensor.init())
{
Serial.println("Failed to detect and initialize sensor!");
while (1) {}
}
// Start continuous back-to-back mode (take readings as
// fast as possible). To use continuous timed mode
// instead, provide a desired inter-measurement period in
// ms (e.g. sensor.startContinuous(100)).
sensor.startContinuous();
}
void loop()
{
if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
int sum = 0;
for(int i=0;i<10;i++){
sum = sum + sensor.readRangeContinuousMillimeters(); //if there is deviation, just minus 10(mm).
delay(100);
}
Serial.print(sum/10); //average the read data
Serial.print("mm");
Serial.println();
}
```