Skip to content

Adding Learning Guides, changing references to board.I2C #17

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 23, 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 @@ -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:
Expand Down
9 changes: 4 additions & 5 deletions adafruit_pct2075.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
4 changes: 3 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ Table of Contents
.. toctree::
:caption: Tutorials

Adafruit PCT2075 Temperature Sensor Learning Guide <https://learn.adafruit.com/adafruit-pct2075-temperature-sensor>

.. toctree::
:caption: Related Products

.. Adafruit PCT2075 Breakout <https://www.adafruit.com/products/4369>
Adafruit PCT2075 Temperature Sensor Breakout <https://www.adafruit.com/products/4369>

.. toctree::
:caption: Other Links
Expand Down
3 changes: 1 addition & 2 deletions examples/pct2075_high_temp_alert_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/pct2075_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down