Skip to content

Commit a5eae66

Browse files
authored
Merge pull request #15 from jposada202020/improving_docs
Improving docs and adding product and learning guide to the API
2 parents fe680ac + 906d03d commit a5eae66

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

adafruit_adt7410.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
1717
**Hardware:**
1818
19+
* `Adafruit's ADT7410 analog temperature Sensor Breakout:
20+
<https://www.adafruit.com/product/4089>`_ (Product ID: 4089)
21+
1922
**Software and Dependencies:**
2023
2124
* Adafruit CircuitPython firmware for the supported boards:
@@ -46,7 +49,36 @@
4649

4750

4851
class ADT7410:
49-
"""Interface to the Analog Devices ADT7410 temperature sensor."""
52+
"""Interface to the Analog Devices ADT7410 temperature sensor.
53+
54+
:param ~busio.I2C i2c_bus: The I2C bus the ADT7410 is connected to.
55+
:param int address: The I2C device address for the sensor. Default is :const:`0x48`
56+
57+
**Quickstart: Importing and using the ADT7410 temperature sensor**
58+
59+
Here is one way of importing the `ADT7410` class so you can use it with the name ``adt``.
60+
First you will need to import the libraries to use the sensor
61+
62+
.. code-block:: python
63+
64+
import busio
65+
import board
66+
import adafruit_adt7410
67+
68+
Once this is done you can define your `busio.I2C` object and define your sensor object
69+
70+
.. code-block:: python
71+
72+
i2c = busio.I2C(board.SCL, board.SDA)
73+
adt = adafruit_adt7410.ADT7410(i2c_bus, address=0x48)
74+
75+
Now you have access to the temperature using :attr:`temperature`.
76+
77+
.. code-block:: python
78+
79+
temperature = adt.temperature
80+
81+
"""
5082

5183
# many modes can be set with register objects for simplicity
5284
ready = ROBit(_ADT7410_STATUS, 7)
@@ -69,7 +101,7 @@ def __init__(self, i2c_bus, address=0x48):
69101

70102
@property
71103
def temperature(self):
72-
"""The temperature in celsius"""
104+
"""The temperature in Celsius"""
73105
temp = self._read_register(_ADT7410_TEMPMSB, 2)
74106
return struct.unpack(">h", temp)[0] / 128
75107

docs/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
ADT7410 High Accuracy I2C Temperature Sensor Learning Guide <https://learn.adafruit.com/adt7410-breakout>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

31+
ADT7410 High Accuracy I2C Temperature Sensor Breakout Board <https://www.adafruit.com/product/4089>
32+
2933
.. toctree::
3034
:caption: Other Links
3135

0 commit comments

Comments
 (0)