跳转到主要内容

通过I2C对BME680传感器的CircuitPython驱动程序

项目描述

简介

Documentation Status Discord Build Status Code Style: Ruff

通过I2C对BME680传感器的CircuitPython驱动程序

依赖项

此驱动程序依赖于

请确保CircuitPython文件系统中所有依赖项都可用。这可以通过下载 Adafruit库和驱动程序捆绑包 来轻松实现。

从PyPI安装

在支持的GNU/Linux系统(如Raspberry Pi)上,您可以从PyPI 安装驱动程序。为当前用户安装

pip3 install adafruit-circuitpython-bme680

要全局安装(在某些情况下可能需要)

sudo pip3 install adafruit-circuitpython-bme680

在您当前项目的虚拟环境中安装

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-bme680

使用示例

import adafruit_bme680
import time
import board

# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C()   # uses board.SCL and board.SDA
bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c)

# change this to match the location's pressure (hPa) at sea level
bme680.sea_level_pressure = 1013.25

while True:
    print("\nTemperature: %0.1f C" % bme680.temperature)
    print("Gas: %d ohm" % bme680.gas)
    print("Humidity: %0.1f %%" % bme680.relative_humidity)
    print("Pressure: %0.3f hPa" % bme680.pressure)
    print("Altitude = %0.2f meters" % bme680.altitude)

    time.sleep(2)

文档

此库的API文档可在 Read the Docs 上找到。

有关构建库文档的信息,请参阅 本指南

贡献

欢迎贡献!在向本项目贡献力量之前,请阅读我们的 行为准则 以帮助本项目保持友好。

项目详情


下载文件

下载适用于您平台的应用程序。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分布

adafruit_circuitpython_bme680-3.7.8.tar.gz (30.8 kB 查看哈希值)

上传时间

构建分布

adafruit_circuitpython_bme680-3.7.8-py3-none-any.whl (10.6 kB 查看哈希值)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面