Skip to content

improving docs #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ Usage Example

import time
import board
import busio
import adafruit_tc74
i2c = busio.I2C(board.SCL, board.SDA)

i2c = board.I2C()
tc = adafruit_tc74.TC74(i2c)

while True:
Expand Down
35 changes: 29 additions & 6 deletions adafruit_tc74.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

**Hardware:**

* Adafruit TC74: https://www.adafruit.com/product/4375
* Adafruit Breadboard Friendly I2C Temperature Sensor TC74: https://www.adafruit.com/product/4375

**Software and Dependencies:**

Expand Down Expand Up @@ -44,9 +44,32 @@
class TC74:
"""
Driver for the Microchip TC74 Digital Temperature Sensor.
:param i2c_bus: The I2C bus the TC74 is connected to.
:param address: The I2C device address for the sensor. Default is
``0x48``.
:param ~busio.I2C i2c_bus: The I2C bus the TC74 is connected to
:param int address: The I2C device address for the sensor. Default is :const:`0x48`

**Quickstart: Importing and using the TC74**

Here is an example of using the :class:`TC74` class.
First you will need to import the libraries to use the sensor

.. code-block:: python

import board
import adafruit_tc74

Once this is done you can define your `board.I2C` object and define your sensor object

.. code-block:: python

i2c = board.I2C() # uses board.SCL and board.SDA
tc = adafruit_tc74.TC74(i2c)

Now you have access to the temperature using :attr:`temperature`.

.. code-block:: python

temperature = tc.temperature

"""

def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS):
Expand All @@ -67,7 +90,7 @@ def __init__(self, i2c_bus, address=TC74_DEFAULT_ADDRESS):
@property
def temperature(self):
"""
Returns the current temperature in degrees celsius. Resolution
is 1 degrees C.
Returns the current temperature in degrees Celsius. Resolution
is 1 degrees Celsius.
"""
return self._temperature
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Table of Contents
.. toctree::
:caption: Related Products

.. Adafruit TC74 <https://www.adafruit.com/product/4375>
Adafruit TC74 <https://www.adafruit.com/product/4375>

.. toctree::
:caption: Other Links
Expand Down
1 change: 0 additions & 1 deletion examples/tc74_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import adafruit_tc74

i2c = board.I2C()

tc = adafruit_tc74.TC74(i2c)

while True:
Expand Down