Skip to content

Commit 6c9561b

Browse files
committed
Add better description to advace script
Add better description to the advance script. Add the `venv` folder to be ignore. Add the ussage of the script for the documentation.
1 parent c1276db commit 6c9561b

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ bundles
1313
.eggs
1414
dist
1515
**/*.egg-info
16+
venv

docs/examples.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@ Ensure your device works with this simple test.
66
.. literalinclude:: ../examples/dht_simpletest.py
77
:caption: examples/dht_simpletest.py
88
:linenos:
9+
10+
11+
Time calibration advance test
12+
------------
13+
14+
Check what is the best time your sensor.
15+
16+
.. literalinclude:: ../examples/dht_time_calibration_advance.py
17+
:caption: examples/dht_time_calibration_advance.py
18+
:linenos:

examples/dht_time_calibration.py renamed to examples/dht_time_calibration_advance.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# SPDX-FileCopyrightText: 2021 yeyeto2788 for Adafruit Industries
22
# SPDX-License-Identifier: MIT
33

4+
"""
5+
This script let's you check the best timing for you sensor as other people have face timing issues
6+
as seen on issue https://github.com/adafruit/Adafruit_CircuitPython_DHT/issues/66.
7+
8+
By changing the variables values below you will be able to check the best timing for you sensor,
9+
take into account that by most datasheets the timing for the sensor are 0.001 DHT22 and
10+
0.018 for DHT11 which are the default values of the library.
11+
"""
12+
413
import json
514
import time
615

716
import board
817

918
import adafruit_dht
1019

20+
# Change the pin used below
1121
pin_to_use = "PG6"
1222

1323
# Maximum number of tries per timing
@@ -41,10 +51,10 @@
4151
# Instantiate the DHT11 object.
4252
dhtDevice = adafruit_dht.DHT11(pin=getattr(board, pin_to_use))
4353
# Change the default wait time for triggering the read.
44-
# pylint: disable=W0212
54+
# pylint: disable=protected-access
4555
dhtDevice._trig_wait = milliseconds
4656

47-
# pylint: disable=W0212
57+
# pylint: disable=protected-access
4858
print(f"Using 'trig_wait' of {dhtDevice._trig_wait}")
4959
# Reset the read count for next loop
5060
reads_count = 0

0 commit comments

Comments
 (0)