diff --git a/README.rst b/README.rst index aec40d3..3376fee 100644 --- a/README.rst +++ b/README.rst @@ -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: diff --git a/adafruit_tc74.py b/adafruit_tc74.py index f9a292a..2b74026 100644 --- a/adafruit_tc74.py +++ b/adafruit_tc74.py @@ -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:** @@ -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): @@ -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 diff --git a/docs/index.rst b/docs/index.rst index f157ffb..0ccc840 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -26,7 +26,7 @@ Table of Contents .. toctree:: :caption: Related Products -.. Adafruit TC74 + Adafruit TC74 .. toctree:: :caption: Other Links diff --git a/examples/tc74_simpletest.py b/examples/tc74_simpletest.py index d5b4593..407f7c7 100755 --- a/examples/tc74_simpletest.py +++ b/examples/tc74_simpletest.py @@ -6,7 +6,6 @@ import adafruit_tc74 i2c = board.I2C() - tc = adafruit_tc74.TC74(i2c) while True: