We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f5c3f84 commit 5b4058aCopy full SHA for 5b4058a
examples/ds18x20_asynctest.py
@@ -17,12 +17,15 @@
17
18
# Scan for sensors and grab the first one found.
19
ds18 = DS18X20(ow_bus, ow_bus.scan()[0])
20
+ds18.resolution = 12
21
22
# Main loop to print the temperature every second.
23
while True:
24
conversion_delay = ds18.start_temperature_read()
25
conversion_ready_at = time.monotonic() + conversion_delay
- if time.monotonic() < conversion_ready_at:
26
- print("waiting...")
27
- print('Temperature: {0:0.3f}C'.format(ds18.read_temperature()))
+ print("waiting", end="")
+ while time.monotonic() < conversion_ready_at:
28
+ print(".", end="")
29
+ time.sleep(0.1)
30
+ print('\nTemperature: {0:0.3f}C\n'.format(ds18.read_temperature()))
31
time.sleep(1.0)
0 commit comments