Skip to content

Commit 2c93897

Browse files
Merge pull request #4 from jposada202020/improving_docs
improving docs
2 parents 401b1e4 + 0b03e42 commit 2c93897

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ Usage Example
5858
5959
import time
6060
import board
61-
import busio
6261
import adafruit_tc74
63-
i2c = busio.I2C(board.SCL, board.SDA)
6462
63+
i2c = board.I2C()
6564
tc = adafruit_tc74.TC74(i2c)
6665
6766
while True:

adafruit_tc74.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
**Hardware:**
1717
18-
* Adafruit TC74: https://www.adafruit.com/product/4375
18+
* Adafruit Breadboard Friendly I2C Temperature Sensor TC74: https://www.adafruit.com/product/4375
1919
2020
**Software and Dependencies:**
2121
@@ -44,9 +44,32 @@
4444
class TC74:
4545
"""
4646
Driver for the Microchip TC74 Digital Temperature Sensor.
47-
:param i2c_bus: The I2C bus the TC74 is connected to.
48-
:param address: The I2C device address for the sensor. Default is
49-
``0x48``.
47+
:param ~busio.I2C i2c_bus: The I2C bus the TC74 is connected to
48+
:param int address: The I2C device address for the sensor. Default is :const:`0x48`
49+
50+
**Quickstart: Importing and using the TC74**
51+
52+
Here is an example of using the :class:`TC74` class.
53+
First you will need to import the libraries to use the sensor
54+
55+
.. code-block:: python
56+
57+
import board
58+
import adafruit_tc74
59+
60+
Once this is done you can define your `board.I2C` object and define your sensor object
61+
62+
.. code-block:: python
63+
64+
i2c = board.I2C() # uses board.SCL and board.SDA
65+
tc = adafruit_tc74.TC74(i2c)
66+
67+
Now you have access to the temperature using :attr:`temperature`.
68+
69+
.. code-block:: python
70+
71+
temperature = tc.temperature
72+
5073
"""
5174

5275
def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS):
@@ -67,7 +90,7 @@ def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS):
6790
@property
6891
def temperature(self):
6992
"""
70-
Returns the current temperature in degrees celsius. Resolution
71-
is 1 degrees C.
93+
Returns the current temperature in degrees Celsius. Resolution
94+
is 1 degrees Celsius.
7295
"""
7396
return self._temperature

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Table of Contents
2626
.. toctree::
2727
:caption: Related Products
2828

29-
.. Adafruit TC74 <https://www.adafruit.com/product/4375>
29+
Adafruit TC74 <https://www.adafruit.com/product/4375>
3030

3131
.. toctree::
3232
:caption: Other Links

examples/tc74_simpletest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import adafruit_tc74
77

88
i2c = board.I2C()
9-
109
tc = adafruit_tc74.TC74(i2c)
1110

1211
while True:

0 commit comments

Comments
 (0)