We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 06243aa commit 60ef01aCopy full SHA for 60ef01a
adafruit_am2320.py
@@ -85,7 +85,15 @@ class AM2320:
85
86
"""
87
def __init__(self, i2c_bus, address=AM2320_DEFAULT_ADDR):
88
- self._i2c = I2CDevice(i2c_bus, address)
+ for _ in range(3):
89
+ # retry since we have to wake up the devices
90
+ try:
91
+ self._i2c = I2CDevice(i2c_bus, address)
92
+ return
93
+ except ValueError:
94
+ pass
95
+ time.sleep(0.25)
96
+ raise ValueError("AM2320 not found")
97
98
def _read_register(self, register, length):
99
with self._i2c as i2c:
0 commit comments