I have an Adafruit QTPY 2040 connected to a DPS310 Pressure sensor via the Stemma QT port with a cable.
I tried running the sample code provided:
---------------------------------
Code: Select all
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
from adafruit_dps310.basic import DPS310
i2c = busio.I2C(board.SCL1, board.SDA1)
dps310 = DPS310(i2c)
while True:
print("Temperature = %.2f *C" % dps310.temperature)
print("Pressure = %.2f hPa" % dps310.pressure)
print("")
time.sleep(1.0)
I even update the i2c = busio.I2C(board.SCL1, board.SDA1) to SCL1 and SDA1 for the non-board i2c connection (found that in a adafruit forum post)
Still no luck running the code.
I keep getting the error:
File "code.py", line 8, in <module>
NameError: name 'busio' is not defined
I checked and I have the DSP310 modules load in the lib directory.
Any help would be appreciated.