|
6 | 6 | `adafruit_ahtx0`
|
7 | 7 | ================================================================================
|
8 | 8 |
|
9 |
| -CircuitPython driver for the Adafruit AHT10 Humidity and Temperature Sensor |
| 9 | +CircuitPython driver for the Adafruit AHT10/AHT20 Temperature & Humidity Sensor |
10 | 10 |
|
11 | 11 |
|
12 | 12 | * Author(s): Kattni Rembor
|
|
16 | 16 |
|
17 | 17 | **Hardware:**
|
18 | 18 |
|
19 |
| -* This is a library for the Adafruit AHT20 breakout: |
| 19 | +* This is a library for the Adafruit AHT20 Temperature & Humidity Sensor breakout: |
20 | 20 | https://www.adafruit.com/product/4566
|
21 | 21 |
|
22 | 22 | **Software and Dependencies:**
|
|
42 | 42 |
|
43 | 43 |
|
44 | 44 | class AHTx0:
|
45 |
| - """Interface library for AHT10/AHT20 temperature+humidity sensors""" |
| 45 | + """ |
| 46 | + Interface library for AHT10/AHT20 temperature+humidity sensors |
| 47 | +
|
| 48 | + :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` |
| 50 | +
|
| 51 | + **Quickstart: Importing and using the AHT10/AHT20 temperature sensor** |
| 52 | +
|
| 53 | + Here is one way of importing the `AHTx0` class so you can use it with the name ``aht``. |
| 54 | + First you will need to import the libraries to use the sensor |
| 55 | +
|
| 56 | + .. code-block:: python |
| 57 | +
|
| 58 | + import busio |
| 59 | + import board |
| 60 | + import adafruit_ahtx0 |
| 61 | +
|
| 62 | + Once this is done you can define your `busio.I2C` object and define your sensor object |
| 63 | +
|
| 64 | + .. code-block:: python |
| 65 | +
|
| 66 | + i2c = busio.I2C(board.SCL, board.SDA) |
| 67 | + aht = adafruit_ahtx0.AHTx0(i2c) |
| 68 | +
|
| 69 | + Now you have access to the temperature and humidity using |
| 70 | + the :attr:`temperature` and :attr:`relative_humidity` attributes |
| 71 | +
|
| 72 | + .. code-block:: python |
| 73 | +
|
| 74 | + temperature = aht.temperature |
| 75 | + relative_humidity = aht.relative_humidity |
| 76 | +
|
| 77 | + """ |
46 | 78 |
|
47 | 79 | def __init__(self, i2c_bus, address=AHTX0_I2CADDR_DEFAULT):
|
48 | 80 | time.sleep(0.02) # 20ms delay to wake up
|
@@ -90,7 +122,7 @@ def relative_humidity(self):
|
90 | 122 |
|
91 | 123 | @property
|
92 | 124 | def temperature(self):
|
93 |
| - """The measured temperature in degrees Celcius.""" |
| 125 | + """The measured temperature in degrees Celsius.""" |
94 | 126 | self._readdata()
|
95 | 127 | return self._temp
|
96 | 128 |
|
|
0 commit comments