Other Arduino Codes and Videos by Robojax

Using CJMCU VL53L0X Laser Distance meter with Arduino Robojax.com

Using CJMCU VL53L0X Laser Distance meter with Arduino

This video shows you how to use the VL53L0X module to measure distance. This is with TXS0108E 8-Bit Bi-directional, Level-Shifting, Voltage Translator

Source code for VL523L0X Distance measurement module for Arduino


 
/* 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. 
Updated by Ahmad Shamshiri for Robojax.com on July 23, 2018 in Ajax, Ontario, Canada
Watch video instruction for this code: https://youtu.be/0PnAyt51IU4
download library and get other resources for this code at http://robojax.com
*/

#include <Wire.h>
#include <VL53L0X.h>

VL53L0X sensor;

void setup()
{
  Serial.begin(9600);
  Serial.println("Robojax CJMCU VL523L0X laser distance test");
  Wire.begin();

  sensor.init();
  sensor.setTimeout(500);

  // 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()
{
  Serial.print(sensor.readRangeContinuousMillimeters());// print distance

  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.println();
}