Skip to content

changing board.I2C reference, adding learning guide, product link(improvement) #6

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 24, 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
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ Usage Example

import time
import board
import busio
import adafruit_ahtx0

# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C()
sensor = adafruit_ahtx0.AHTx0(i2c)

while True:
Expand Down
9 changes: 4 additions & 5 deletions adafruit_ahtx0.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,23 @@ class AHTx0:
Interface library for AHT10/AHT20 temperature+humidity sensors

:param ~busio.I2C i2c_bus: The I2C bus the AHT10/AHT20 is connected to.
:param address: The I2C device address for the sensor. Default is :const:`0x38`
:param int address: The I2C device address. Default is :const:`0x38`

**Quickstart: Importing and using the AHT10/AHT20 temperature sensor**

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

.. code-block:: python

import busio
import board
import adafruit_ahtx0

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
aht = adafruit_ahtx0.AHTx0(i2c)

Now you have access to the temperature and humidity using
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Table of Contents
.. toctree::
:caption: Tutorials

Adafruit AHT20 - Temperature & Humidity Sensor Breakout Board Learning Guide <https://learn.adafruit.com/adafruit-aht20>

.. toctree::
:caption: Related Products

Expand Down
5 changes: 2 additions & 3 deletions examples/ahtx0_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@

import time
import board
import busio
import adafruit_ahtx0

# Create the sensor object using I2C
i2c = busio.I2C(board.SCL, board.SDA)
# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C()
sensor = adafruit_ahtx0.AHTx0(i2c)

while True:
Expand Down