Skip to content

Commit 67827bd

Browse files
Merge pull request #5 from jposada202020/adding_board.I2C_definition
Adding learning guide, changing references to board.I2C
2 parents 5f2ac47 + c68fb35 commit 67827bd

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ Usage Example
6262
.. code-block:: python
6363
6464
import time
65-
import busio
6665
import board
6766
import adafruit_sht4x
6867
69-
i2c = busio.I2C(board.SCL, board.SDA)
68+
i2c = board.I2C() # uses board.SCL and board.SDA
7069
sht = adafruit_sht4x.SHT4x(i2c)
7170
print("Found SHT4x with serial number", hex(sht.serial_number))
7271

adafruit_sht4x.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,25 @@ class SHT4x:
8686
"""
8787
A driver for the SHT4x temperature and humidity sensor.
8888
89-
:param ~busio.I2C i2c_bus: The `busio.I2C` object to use.
90-
:param int address: The I2C device address for the sensor. Default is :const:`0x44`
89+
:param ~busio.I2C i2c_bus: The I2C bus the SHT4x is connected to.
90+
:param int address: The I2C device address. Default is :const:`0x44`
9191
9292
9393
**Quickstart: Importing and using the SHT4x temperature and humidity sensor**
9494
95-
Here is one way of importing the `SHT4x` class so you can use it with the name ``sht``.
95+
Here is an example of using the :class:`SHT4x`.
9696
First you will need to import the libraries to use the sensor
9797
9898
.. code-block:: python
9999
100-
import busio
101100
import board
102101
import adafruit_sht4x
103102
104-
Once this is done you can define your `busio.I2C` object and define your sensor object
103+
Once this is done you can define your `board.I2C` object and define your sensor object
105104
106105
.. code-block:: python
107106
108-
i2c = busio.I2C(board.SCL, board.SDA)
107+
i2c = board.I2C() # uses board.SCL and board.SDA
109108
sht = adafruit_sht4x.SHT4x(i2c)
110109
111110
You can now make some initial settings on the sensor

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
Adafruit Sensirion SHT40 Temperature & Humidity Sensor <https://learn.adafruit.com/adafruit-sht40-temperature-humidity-sensor>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

examples/sht4x_simpletest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
# SPDX-License-Identifier: MIT
44

55
import time
6-
import busio
76
import board
87
import adafruit_sht4x
98

10-
i2c = busio.I2C(board.SCL, board.SDA)
9+
i2c = board.I2C()
1110
sht = adafruit_sht4x.SHT4x(i2c)
1211
print("Found SHT4x with serial number", hex(sht.serial_number))
1312

0 commit comments

Comments
 (0)