Skip to content

Commit ede42c4

Browse files
committed
Adding delay to _uart.write()
1 parent 32a0a91 commit ede42c4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

adafruit_us100.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def distance(self):
6666
"""
6767
for _ in range(2): # Attempt to read twice.
6868
self._uart.write(bytes([0x55]))
69+
time.sleep(0.1)
6970
data = self._uart.read(2) # 2 byte return for distance.
7071
if data: # If there is a reading, exit the loop.
7172
break
@@ -87,6 +88,7 @@ def temperature(self):
8788
"""Return the on-chip temperature, in Celsius"""
8889
for _ in range(2): # Attempt to read twice.
8990
self._uart.write(bytes([0x50]))
91+
time.sleep(0.1)
9092
data = self._uart.read(1) # 1 byte return for temp
9193
if data: # If there is a reading, exit the loop.
9294
break

0 commit comments

Comments
 (0)