Code: Select all
Traceback (most recent call last):
File "code.py", line 36, in <module>
File "adafruit_ltr390.py", line 286, in __init__
File "adafruit_ltr390.py", line 292, in initialize
File "adafruit_ltr390.py", line 315, in _reset
File "adafruit_register/i2c_bit.py", line 43, in __get__
OSError: [Errno 116] ETIMEDOUT
Code: Select all
# Let's see what we have here
import board
import busio
import time
#Stemma QT port on QTPy 2040
#i2c_stemma_bus = busio.I2C(board.SCL1, board.SDA1)
#I2C pins on QTPy 2040, single I2C port on other boards
info_i2c_port = 0
try:
i2c_stemma_bus = busio.I2C(board.SCL, board.SDA)
except RuntimeError:
i2c_stemma_bus = busio.I2C(board.SCL1, board.SDA1)
info_i2c_port = 1
print("Using i2c port ", info_i2c_port)
# Using to check the i2c wiring, since I'm using these two sensors
# together anyway.
import adafruit_htu31d
temp_light = 0
try:
temp_light = adafruit_htu31d.HTU31D(i2c_stemma_bus, 0x40)
except ValueError:
print("HTU31D sensor on 0x40 not attached.")
if(temp_light):
print("HTU31D sensor on 0x40 found.")
import adafruit_ltr390
light_sens = 0
try:
light_sens = adafruit_ltr390.LTR390(i2c_stemma_bus)
except ValueError:
print("LTR390 sensor not attached.")
if(light_sens):
print("LTR390 sensor found.")
while True:
if(temp_light):
print("HTU31D temperature: %0.1f C" % temp_light.temperature,
"HTU31D humidity: %0.1f %%" % temp_light.relative_humidity)
if(light_sens):
print("UV: ", light_sens.uvs, "Ambient Light: ", light_sens.light)
time.sleep(1)
CPy 7.0 on NRF52840 Feather Sense: Code runs as expected
CPy 7.0 on QTPy M0 Haxpress: Memory error (as expected)
CPy 7.0 on QTPy RP2040: ETIMEOUT error
CPy 7.1b on QTPy RP2040: ETIMEOUT error
CPy 6.3 on QTPy RP2040: Code runs as expected
(Was going to ask the OP of viewtopic.php?f=60&t=178596 to try changing CPy version, but topic is locked)