Skip to content

VL53L0X — fast distance [cm] (non-blocking) (vl53l0x_fast_dist_cm)

What it does: Returns the non-blocking distance from VL53L0X in centimeters as an integer conversion from mm.

vl53l0x_fast_dist_cm

Inputs

  • Field ID: selection of initialized rangefinder instance.

Output

  • Number: distance in cm (int(mm/10)).

When to use it

  • When you need a fast non-blocking reading and a coarser cm unit is enough.
  • For simple "closer than 20cm" type conditions.

Tips and pitfalls

  • The conversion to cm is integer, so it loses decimal precision.
  • Like the mm variant, it can return the last known sample.

Usage example

example_vl53l0x_cm

Open example in ESP IDE

Generated Python example

value = int(tof1.read_non_blocking() / 10)