From fb074847ba88b272a46c143d363d62fd63cf6c1e Mon Sep 17 00:00:00 2001 From: jposada202020 Date: Fri, 23 Apr 2021 19:51:09 -0400 Subject: [PATCH] Adding Learning Guides, changing references to board.I2C --- README.rst | 3 +-- adafruit_pct2075.py | 9 ++++----- docs/index.rst | 4 +++- examples/pct2075_high_temp_alert_example.py | 3 +-- examples/pct2075_simpletest.py | 4 +--- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/README.rst b/README.rst index 456ad67..978dbd7 100644 --- a/README.rst +++ b/README.rst @@ -63,10 +63,9 @@ Usage Example import time import board - import busio import adafruit_pct2075 - i2c = busio.I2C(board.SCL, board.SDA) + i2c = board.I2C() pct = adafruit_pct2075.PCT2075(i2c) while True: diff --git a/adafruit_pct2075.py b/adafruit_pct2075.py index 72cda38..ef72a6d 100644 --- a/adafruit_pct2075.py +++ b/adafruit_pct2075.py @@ -69,24 +69,23 @@ class PCT2075: """Driver for the PCT2075 Digital Temperature Sensor and Thermal Watchdog. :param ~busio.I2C i2c_bus: The I2C bus the PCT2075 is connected to. - :param address: The I2C device address for the sensor. Default is :const:`0x37` + :param address: The I2C device address. Default is :const:`0x37` **Quickstart: Importing and using the PCT2075 temperature sensor** - Here is one way of importing the `PCT2075` class so you can use it with the name ``pct``. + Here is an example of using the :class:`PCT2075` class. First you will need to import the libraries to use the sensor .. code-block:: python - import busio import board import adafruit_pct2075 - Once this is done you can define your `busio.I2C` object and define your sensor object + Once this is done you can define your `board.I2C` object and define your sensor object .. code-block:: python - i2c = busio.I2C(board.SCL, board.SDA) + i2c = board.I2C() # uses board.SCL and board.SDA pct = adafruit_pct2075.PCT2075(i2c) Now you have access to the temperature using the attribute :attr:`temperature`. diff --git a/docs/index.rst b/docs/index.rst index 4f7aae0..08f8b52 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,10 +23,12 @@ Table of Contents .. toctree:: :caption: Tutorials + Adafruit PCT2075 Temperature Sensor Learning Guide + .. toctree:: :caption: Related Products -.. Adafruit PCT2075 Breakout + Adafruit PCT2075 Temperature Sensor Breakout .. toctree:: :caption: Other Links diff --git a/examples/pct2075_high_temp_alert_example.py b/examples/pct2075_high_temp_alert_example.py index f5b9a1f..3f535c5 100644 --- a/examples/pct2075_high_temp_alert_example.py +++ b/examples/pct2075_high_temp_alert_example.py @@ -3,10 +3,9 @@ import time import board -import busio import adafruit_pct2075 -i2c = busio.I2C(board.SCL, board.SDA) +i2c = board.I2C() pct = adafruit_pct2075.PCT2075(i2c) pct.high_temperature_threshold = 35.5 diff --git a/examples/pct2075_simpletest.py b/examples/pct2075_simpletest.py index 6f5303f..cd05e9d 100755 --- a/examples/pct2075_simpletest.py +++ b/examples/pct2075_simpletest.py @@ -3,11 +3,9 @@ import time import board -import busio import adafruit_pct2075 -i2c = busio.I2C(board.SCL, board.SDA) - +i2c = board.I2C() pct = adafruit_pct2075.PCT2075(i2c) while True: