File tree Expand file tree Collapse file tree 4 files changed +46
-4
lines changed Expand file tree Collapse file tree 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:
2323* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython >`_
2424* `Adafruit OneWire <https://github.com/adafruit/Adafruit_CircuitPython_OneWire >`_
2525
26- **Note: ** This library depends on the OneWire library and will **not ** work on the Raspberry Pi
27-
2826Please ensure all dependencies are available on the CircuitPython filesystem.
2927This is easily achieved by downloading
3028`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
@@ -37,6 +35,7 @@ Usage Example
3735 import board
3836 from adafruit_onewire.bus import OneWireBus
3937 from adafruit_ds18x20 import DS18X20
38+
4039 ow_bus = OneWireBus(board.D2)
4140 ds18 = DS18X20(ow_bus, ow_bus.scan()[0 ])
4241 ds18.temperature
Original file line number Diff line number Diff line change 99Driver for Dallas 1-Wire temperature sensor.
1010
1111* Author(s): Carter Nelson
12+
13+ **Software and Dependencies:**
14+
15+ * Adafruit CircuitPython firmware for the supported boards:
16+ https://circuitpython.org/downloads
17+
1218"""
1319
1420__version__ = "0.0.0-auto.0"
2834
2935
3036class 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+ """
3267
3368 def __init__ (self , bus , address ):
3469 if address .family_code == 0x10 or address .family_code == 0x28 :
Original file line number Diff line number Diff line change 2323# Uncomment the below if you use native CircuitPython modules such as
2424# digitalio, micropython and busio. List the modules you use. Without it, the
2525# 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+ ]
2729
2830intersphinx_mapping = {
2931 "python" : ("https://docs.python.org/3.4" , None ),
3032 "CircuitPython" : ("https://circuitpython.readthedocs.io/en/latest/" , None ),
33+ "adafruit_onewire" : (
34+ "https://circuitpython.readthedocs.io/projects/onewire/en/latest/" ,
35+ None ,
36+ ),
3137}
3238
3339# 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
2323.. toctree ::
2424 :caption: Tutorials
2525
26+ DS18B20 Learning Guide <https://learn.adafruit.com/using-ds18b20-temperature-sensor-with-circuitpython >
27+
2628.. toctree ::
2729 :caption: Related Products
2830
You can’t perform that action at this time.
0 commit comments