> For the complete documentation index, see [llms.txt](https://learn.breadstick.ca/breadstick/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.breadstick.ca/breadstick/breadsticks/support-boards/i2c-devices/distance-crouton.md).

# Distance Crouton

{% tabs %}
{% tab title="Front" %}

<figure><img src="/files/VCSdV4ZquuvZvgFKPcUX" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Back" %}

<figure><img src="/files/0sXFV9LCw9CxjuMSaCQg" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Product Page

<https://shop.breadstick.ca/products/distance-crouton>

## Circuit Python Library

<https://github.com/adafruit/Adafruit_CircuitPython_VL53L4CD>

## VL53L4CD Datasheet

<https://www.st.com/resource/en/datasheet/vl53l4cd.pdf>

## Code

```python
"""
Distance Crouton (VL53L4CD) Demo Code
Breadstick Innovations
April 16, 2024
https://learn.breadstick.ca/breadstick/breadsticks/support-boards/i2c-devices/distance-crouton
"""

import board
import time
import adafruit_vl53l4cd

crouton_i2c = board.I2C()  # Default Breadstick I2C pins D11(SCL) & D12(SDA)
vl53 = adafruit_vl53l4cd.VL53L4CD(crouton_i2c)

# OPTIONAL: can set non-default values
vl53.inter_measurement = 0
vl53.timing_budget = 50

print("VL53L4CD Simple Test.")
print("--------------------")
model_id, module_type = vl53.model_info
print("Model ID: 0x{:0X}".format(model_id))
print("Module Type: 0x{:0X}".format(module_type))
print("Timing Budget: {}".format(vl53.timing_budget))
print("Inter-Measurement: {}".format(vl53.inter_measurement))
print("--------------------")

vl53.start_ranging()

while True:

    #while not vl53.data_ready:
    #    pass
    vl53.clear_interrupt()

    distance = vl53.distance

    plotter_data = (distance,)  # Mu's Plotter only displays tuples, this is a single object tuple
    print(plotter_data)

    print(f'Distance: {distance} cm')
    print("")

    time.sleep(0.1)

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.breadstick.ca/breadstick/breadsticks/support-boards/i2c-devices/distance-crouton.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
