adafruit / adafruit/Adafruit_CircuitPython_BME680
Error on DigitalInOut?
- Dominant language
- Python
- Stars
- 63
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
I am getting this error on several scripts to read a BME680
```py
(thomas) thomas@thomas:~/thomas $ python3 bme680_test.py
Traceback (most recent call last):
File "/home/thomas/thomas/bme680_test.py", line 8, in
import adafruit_bme680
File "/home/thomas/thomas/lib/python3.13/site-packages/adafruit_bme680.py", line 672, in
class Adafruit_BME680_SPI(Adafruit_BME680):
...<99 lines>...
self._write(_BME680_REG_STATUS, [spi_mem_page])
File "/home/thomas/thomas/lib/python3.13/site-packages/adafruit_bme680.py", line 724, in Adafruit_BME680_SPI
cs: DigitalInOut,
^^^^^^^^^^^^
```
Code is
```py
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import adafruit_bme680
# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C() # uses board.SCL and board.SDA
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c, debug=False)
# change this to match the location's pressure (hPa) at sea level
bme680.sea_level_pressure = 1013.25
# You will usually have to add an offset to account for the temperature of
# the sensor. This is usually around 5 degrees but varies by use. Use a
# separate temperature sensor to calibrate this one.
temperature_offset = -5
while True:
print("\nTemperature: %0.1f C" % (bme680.temperature + temperature_offset))
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(1)
```
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the import section and Adafruit_BME680_SPI definition in adafruit_bme680.py around line 724, then reproduce the traceback using the provided bme680_test.py script. Trace why DigitalInOut is unavailable during module import; done means the example imports and initializes the I2C sensor without this error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100