3
3
# SPDX-License-Identifier: MIT
4
4
5
5
"""
6
- `` adafruit_si7021` `
6
+ `adafruit_si7021`
7
7
===================
8
8
9
9
This is a CircuitPython driver for the SI7021 temperature and humidity sensor.
20
20
21
21
**Software and Dependencies:**
22
22
23
- * Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
24
- https://github.com/adafruit/circuitpython/releases
23
+ * Adafruit CircuitPython firmware for the supported boards:
24
+ https://circuitpython.org/downloads
25
25
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
26
26
"""
27
27
try :
@@ -91,8 +91,36 @@ class SI7021:
91
91
"""
92
92
A driver for the SI7021 temperature and humidity sensor.
93
93
94
- :param i2c_bus: The `busio.I2C` object to use. This is the only required parameter.
95
- :param int address: (optional) The I2C address of the device.
94
+ :param i2c_bus: The `busio.I2C` object to use.
95
+ :param int address: The I2C device address for the sensor. Default is :const:`0x40`
96
+
97
+ **Quickstart: Importing and using the SI7021 temperature and humidity sensor**
98
+
99
+ Here is one way of importing the `SI7021` class so you can use it
100
+ with the name ``si_sensor``.
101
+ First you will need to import the libraries to use the sensor
102
+
103
+ .. code-block:: python
104
+
105
+ import busio
106
+ import board
107
+ import adafruit_si7021
108
+
109
+ Once this is done you can define your `busio.I2C` object and define your sensor object
110
+
111
+ .. code-block:: python
112
+
113
+ i2c = busio.I2C(board.SCL, board.SDA)
114
+ si_sensor = adafruit_si7021.SI7021(i2c)
115
+
116
+ Now you have access to the temperature and humidity using
117
+ :attr:`temperature` and :attr:`relative_humidity` attributes
118
+
119
+ .. code-block:: python
120
+
121
+ temperature = si_sensor.temperature
122
+ relative_humidity = si_sensor.relative_humidity
123
+
96
124
"""
97
125
98
126
def __init__ (self , i2c_bus , address = 0x40 ):
@@ -146,7 +174,7 @@ def relative_humidity(self):
146
174
147
175
@property
148
176
def temperature (self ):
149
- """The measured temperature in degrees Celcius ."""
177
+ """The measured temperature in degrees Celsius ."""
150
178
self .start_measurement (TEMPERATURE )
151
179
value = self ._data ()
152
180
self ._measurement = 0
@@ -159,7 +187,7 @@ def start_measurement(self, what):
159
187
Starts a measurement of either ``HUMIDITY`` or ``TEMPERATURE``
160
188
depending on the ``what`` argument. Returns immediately, and the
161
189
result of the measurement can be retrieved with the
162
- `` temperature`` and `` relative_humidity` ` properties. This way it
190
+ :attr:` temperature` and :attr:` relative_humidity` properties. This way it
163
191
will take much less time.
164
192
165
193
This can be useful if you want to start the measurement, but don't
0 commit comments