Skip to content
Prev Previous commit
Next Next commit
Update dht_time_calibration.py
Add more details on console output like the number of tries per trig_wait
  • Loading branch information
yeyeto2788 committed Mar 19, 2021
commit 27909fae69d484be9e54922203ad5e71d1c099bd
9 changes: 6 additions & 3 deletions examples/dht_time_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
# Variable to store all reads on a try
reads = {}

print("\nInitializing test.\n")
print(
"\nInitializing test.\n",
f"Total tries per trig_wait {max_retries_per_time}"
)

for milliseconds in range(min_time, max_time, time_increment):
# Instantiate the DHT11 object.
Expand Down Expand Up @@ -78,8 +81,8 @@
milliseconds for milliseconds in reads if reads[milliseconds]['total_reads'] == best_result
]
print(
f"Maximum reads: {best_result} with the "
f"following times: {' ,'.join([str(t) for t in best_times])}"
f"Maximum reads: {best_result} out of {max_retries_per_time} with the "
f"following times: {', '.join([str(t) for t in best_times])}"
)

# change the value on the line below to see all reads performed.
Expand Down