Skip to content

Commit 1e17623

Browse files
Merge pull request #6 from jposada202020/adding_board.I2C_reference
changing board.I2C reference, adding learning guide, product link(improvement)
2 parents 856c271 + e9c24ff commit 1e17623

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ Usage Example
6363
6464
import time
6565
import board
66-
import busio
6766
import adafruit_ahtx0
6867
69-
# Create library object using our Bus I2C port
70-
i2c = busio.I2C(board.SCL, board.SDA)
68+
# Create sensor object, communicating over the board's default I2C bus
69+
i2c = board.I2C()
7170
sensor = adafruit_ahtx0.AHTx0(i2c)
7271
7372
while True:

adafruit_ahtx0.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,23 @@ class AHTx0:
4646
Interface library for AHT10/AHT20 temperature+humidity sensors
4747
4848
:param ~busio.I2C i2c_bus: The I2C bus the AHT10/AHT20 is connected to.
49-
:param address: The I2C device address for the sensor. Default is :const:`0x38`
49+
:param int address: The I2C device address. Default is :const:`0x38`
5050
5151
**Quickstart: Importing and using the AHT10/AHT20 temperature sensor**
5252
53-
Here is one way of importing the `AHTx0` class so you can use it with the name ``aht``.
53+
Here is an example of using the :class:`AHTx0` class.
5454
First you will need to import the libraries to use the sensor
5555
5656
.. code-block:: python
5757
58-
import busio
5958
import board
6059
import adafruit_ahtx0
6160
62-
Once this is done you can define your `busio.I2C` object and define your sensor object
61+
Once this is done you can define your `board.I2C` object and define your sensor object
6362
6463
.. code-block:: python
6564
66-
i2c = busio.I2C(board.SCL, board.SDA)
65+
i2c = board.I2C() # uses board.SCL and board.SDA
6766
aht = adafruit_ahtx0.AHTx0(i2c)
6867
6968
Now you have access to the temperature and humidity using

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 AHT20 - Temperature & Humidity Sensor Breakout Board Learning Guide <https://learn.adafruit.com/adafruit-aht20>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

examples/ahtx0_simpletest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77

88
import time
99
import board
10-
import busio
1110
import adafruit_ahtx0
1211

13-
# Create the sensor object using I2C
14-
i2c = busio.I2C(board.SCL, board.SDA)
12+
# Create sensor object, communicating over the board's default I2C bus
13+
i2c = board.I2C()
1514
sensor = adafruit_ahtx0.AHTx0(i2c)
1615

1716
while True:

0 commit comments

Comments
 (0)