forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Milestone
Description
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; FeatherS2 with ESP32S2
# vs.
Adafruit CircuitPython 6.2.0 on 2021-04-05; Teensy 4.1 with IMXRT1062DVJ6A
Code/REPL & Behavior
This works on 6.2.0 on a FeatherS2, with a SHT31D connected, but no SHT40 connected:
import board
i2c = board.I2C()
try:
import adafruit_sht4x
temp_dev = adafruit_sht4x.SHT4x(i2c)
t = temp_dev.temperature
print("SHT40", t, "°C")
except (OSError, RuntimeError) as e:
import adafruit_sht31d
temp_dev = adafruit_sht31d.SHT31D(i2c)
t = temp_dev.temperature
print("SHT31D", t, "°C")
Result:
code.txt output:
SHT31D 26.0841 °C
But same doesn't work on a Teensy 4.1:
code.txt output:
Traceback (most recent call last):
File "code.txt", line 14, in <module>
File "code.txt", line 12, in <module>
File "adafruit_sht31d.py", line 155, in __init__
File "adafruit_bus_device/i2c_device.py", line 50, in __init__
File "adafruit_bus_device/i2c_device.py", line 166, in __probe_for_device
File "adafruit_bus_device/i2c_device.py", line 163, in __probe_for_device
ValueError: No I2C device at address: 0x44
As expected, this is fine on the Teensy 4.1:
import board
i2c = board.I2C()
import adafruit_sht31d
temp_dev = adafruit_sht31d.SHT31D(i2c)
t = temp_dev.temperature
print("SHT31D", t, "°C")
Result:
code.txt output:
SHT31D 26.3806 °C
I tried to set temp_dev to None on exception and gc.collect(), but same result. Tried with
context manager but there's no __exit__
.