Skip to content

adding board.I2C, adding learning guide, product description #10

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,11 +63,10 @@ Usage Example
.. code-block:: python3

import time
import busio
import board
import adafruit_shtc3

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
sht = adafruit_shtc3.SHTC3(i2c)

while True:
Expand Down
13 changes: 6 additions & 7 deletions adafruit_shtc3.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,23 @@ class SHTC3:
"""
A driver for the SHTC3 temperature and humidity sensor.

:param ~busio.I2C i2c_bus: The `busio.I2C` object to use. This is the only required parameter.
:param ~busio.I2C i2c_bus: The I2C bus the SHTC3 is connected to.

**Quickstart: Importing and using the SHTC3 temperature and humidity sensor**

Here is one way of importing the `SHTC3` class so you can use it with the name ``sht``.
First you will need to import the helper libraries to use the sensor
Here is an example of using the :class:`SHTC3`.
First you will need to import the libraries to use the sensor

.. code-block:: python

import busio
import board
import adafruit_shtc3

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

.. code-block:: python

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
sht = adafruit_shtc3.SHTC3(i2c)

Now you have access to the temperature and humidity using the :attr:`measurements`.
Expand Down Expand Up @@ -146,7 +145,7 @@ def reset(self):
self._write_command(_SHTC3_SOFTRESET)

except RuntimeError as run_err:
if run_err.args and run_err.args[0] != "I2C slave address was NACK'd":
if run_err.args and run_err.args[0] != "I2C device address was NACK'd":
raise run_err
time.sleep(0.001)

Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ Table of Contents
.. toctree::
:caption: Tutorials


Adafruit Sensirion SHTC3 Temperature & Humidity Sensor Learning Guide <https://learn.adafruit.com/adafruit-sensirion-shtc3-temperature-humidity-sensor>

.. toctree::
:caption: Related Products

Adafruit Sensirion SHTC3 Temperature & Humidity Sensor <https://www.adafruit.com/product/4636>

.. toctree::
:caption: Other Links
Expand Down
3 changes: 1 addition & 2 deletions examples/shtc3_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
#
# SPDX-License-Identifier: MIT
import time
import busio
import board
import adafruit_shtc3

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C()
sht = adafruit_shtc3.SHTC3(i2c)

while True:
Expand Down