diff --git a/README.rst b/README.rst index ac58b38..924b0b1 100644 --- a/README.rst +++ b/README.rst @@ -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: diff --git a/adafruit_ahtx0.py b/adafruit_ahtx0.py index dab8d45..bff7a72 100644 --- a/adafruit_ahtx0.py +++ b/adafruit_ahtx0.py @@ -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 diff --git a/docs/index.rst b/docs/index.rst index 13c8720..290bbbe 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,6 +23,8 @@ Table of Contents .. toctree:: :caption: Tutorials + Adafruit AHT20 - Temperature & Humidity Sensor Breakout Board Learning Guide + .. toctree:: :caption: Related Products diff --git a/examples/ahtx0_simpletest.py b/examples/ahtx0_simpletest.py index c835127..f582427 100644 --- a/examples/ahtx0_simpletest.py +++ b/examples/ahtx0_simpletest.py @@ -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: