File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -63,11 +63,10 @@ Usage Example
63
63
64
64
import time
65
65
import board
66
- import busio
67
66
import adafruit_ahtx0
68
67
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()
71
70
sensor = adafruit_ahtx0.AHTx0(i2c)
72
71
73
72
while True :
Original file line number Diff line number Diff line change @@ -46,24 +46,23 @@ class AHTx0:
46
46
Interface library for AHT10/AHT20 temperature+humidity sensors
47
47
48
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`
49
+ :param int address: The I2C device address. Default is :const:`0x38`
50
50
51
51
**Quickstart: Importing and using the AHT10/AHT20 temperature sensor**
52
52
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.
54
54
First you will need to import the libraries to use the sensor
55
55
56
56
.. code-block:: python
57
57
58
- import busio
59
58
import board
60
59
import adafruit_ahtx0
61
60
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
63
62
64
63
.. code-block:: python
65
64
66
- i2c = busio .I2C(board.SCL, board.SDA)
65
+ i2c = board .I2C() # uses board.SCL and board.SDA
67
66
aht = adafruit_ahtx0.AHTx0(i2c)
68
67
69
68
Now you have access to the temperature and humidity using
Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ Table of Contents
23
23
.. toctree ::
24
24
:caption: Tutorials
25
25
26
+ Adafruit AHT20 - Temperature & Humidity Sensor Breakout Board Learning Guide <https://learn.adafruit.com/adafruit-aht20 >
27
+
26
28
.. toctree ::
27
29
:caption: Related Products
28
30
Original file line number Diff line number Diff line change 7
7
8
8
import time
9
9
import board
10
- import busio
11
10
import adafruit_ahtx0
12
11
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 ()
15
14
sensor = adafruit_ahtx0 .AHTx0 (i2c )
16
15
17
16
while True :
You can’t perform that action at this time.
0 commit comments