File tree 4 files changed +46
-4
lines changed 4 files changed +46
-4
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,6 @@ This driver depends on:
23
23
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython >`_
24
24
* `Adafruit OneWire <https://github.com/adafruit/Adafruit_CircuitPython_OneWire >`_
25
25
26
- **Note: ** This library depends on the OneWire library and will **not ** work on the Raspberry Pi
27
-
28
26
Please ensure all dependencies are available on the CircuitPython filesystem.
29
27
This is easily achieved by downloading
30
28
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
@@ -37,6 +35,7 @@ Usage Example
37
35
import board
38
36
from adafruit_onewire.bus import OneWireBus
39
37
from adafruit_ds18x20 import DS18X20
38
+
40
39
ow_bus = OneWireBus(board.D2)
41
40
ds18 = DS18X20(ow_bus, ow_bus.scan()[0 ])
42
41
ds18.temperature
Original file line number Diff line number Diff line change 9
9
Driver for Dallas 1-Wire temperature sensor.
10
10
11
11
* Author(s): Carter Nelson
12
+
13
+ **Software and Dependencies:**
14
+
15
+ * Adafruit CircuitPython firmware for the supported boards:
16
+ https://circuitpython.org/downloads
17
+
12
18
"""
13
19
14
20
__version__ = "0.0.0-auto.0"
28
34
29
35
30
36
class DS18X20 :
31
- """Class which provides interface to DS18X20 temperature sensor."""
37
+ """Class which provides interface to DS18X20 temperature sensor
38
+ :param bus: The bus the DS18X20 is connected to
39
+ :param int address: The device address.
40
+
41
+ **Quickstart: Importing and using the device**
42
+
43
+ Here is an example of using the :class:`DS18X20` class.
44
+ First you will need to import the libraries to use the sensor
45
+
46
+ .. code-block:: python
47
+
48
+ import board
49
+ from adafruit_onewire.bus import OneWireBus
50
+ from adafruit_ds18x20 import DS18X20
51
+
52
+ Once this is done you can define your :class:`adafruit_onewire.bus.OneWireBus`
53
+ object and define your sensor object
54
+
55
+ .. code-block:: python
56
+
57
+ ow_bus = OneWireBus(board.D5)
58
+ ds18 = DS18X20(ow_bus, ow_bus.scan()[0])
59
+
60
+ Now you have access to the :attr:`temperature` attribute
61
+
62
+ .. code-block:: python
63
+
64
+ temperature = ds18.temperature
65
+
66
+ """
32
67
33
68
def __init__ (self , bus , address ):
34
69
if address .family_code == 0x10 or address .family_code == 0x28 :
Original file line number Diff line number Diff line change 23
23
# Uncomment the below if you use native CircuitPython modules such as
24
24
# digitalio, micropython and busio. List the modules you use. Without it, the
25
25
# autodoc module docs will fail to generate with a warning.
26
- # autodoc_mock_imports = ["adafruit_onewire", "micropython", "time"]
26
+ autodoc_mock_imports = [
27
+ "adafruit_onewire" ,
28
+ ]
27
29
28
30
intersphinx_mapping = {
29
31
"python" : ("https://docs.python.org/3.4" , None ),
30
32
"CircuitPython" : ("https://circuitpython.readthedocs.io/en/latest/" , None ),
33
+ "adafruit_onewire" : (
34
+ "https://circuitpython.readthedocs.io/projects/onewire/en/latest/" ,
35
+ None ,
36
+ ),
31
37
}
32
38
33
39
# Add any paths that contain templates here, relative to this directory.
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ Table of Contents
23
23
.. toctree ::
24
24
:caption: Tutorials
25
25
26
+ DS18B20 Learning Guide <https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-circuitpython >
27
+
26
28
.. toctree ::
27
29
:caption: Related Products
28
30
You can’t perform that action at this time.
0 commit comments