> 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/weather-crouton.md).

# Weather Crouton

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

<figure><img src="/files/Ft8WNZZ31KhWnK1wnrv4" alt="" width="563"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Back" %}

<figure><img src="/files/egtzMJQKszGvCuYVDpYz" alt="" width="563"><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## Product Page

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

## Circuit Python Library

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

## BME280 Datasheet

<https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme280-ds002.pdf>

## Code

```python
"""
Weather Crouton (BME280) Demo Code
Breadstick Innovations
April 7, 2024
https://learn.breadstick.ca/breadstick/breadsticks/support-boards/i2c-devices/weather-crouton
"""

import board
import time
from adafruit_bme280 import basic as adafruit_bme280

crouton_i2c = board.I2C()  # Default Breadstick I2C pins D11(SCL) & D12(SDA)
bme280 = adafruit_bme280.Adafruit_BME280_I2C(crouton_i2c)  #

# Sea Level Pressure is defined as 1013.25 hPa
# This number is used for calculating bme280.altitude in meters
bme280.sea_level_pressure = 1013.25

# Uncomment this line if you want to calibrate the altitude to your location
# Warning - natural changes in air pressure will affect altimeter measurements
bme280.sea_level_pressure = bme280.pressure

while True:
    temp = bme280.temperature
    hum = bme280.relative_humidity
    pres = bme280.pressure
    alt = bme280.altitude

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

    print(plotter_data)
    print(f"Temperature: {temp} °C")
    print(f"Humidity: {hum} %")
    print(f"Pressure: {pres} hPa")
    print(f"Altitude: {alt} m")
    print("")

    time.sleep(0.1)

```

<figure><img src="/files/2XX0HkCgTiyZ1OmnEVBN" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/nz0ytAr6uzlxtDJC7Yxt" alt=""><figcaption></figcaption></figure>


---

# 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:

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

The question should be specific, self-contained, and written in natural language.
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.
