Skip to content

Commit fc8f1f7

Browse files
authored
Merge pull request #33 from jposada202020/improving_docs
Improving docs
2 parents e54f975 + b398123 commit fc8f1f7

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

adafruit_sgp30.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
2121
**Software and Dependencies:**
2222
23-
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
23+
* Adafruit CircuitPython firmware for the supported boards:
2424
https://github.com/adafruit/circuitpython/releases
2525
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2626
"""
@@ -43,6 +43,40 @@
4343
class Adafruit_SGP30:
4444
"""
4545
A driver for the SGP30 gas sensor.
46+
47+
:param ~busio.I2C i2c: The I2C bus the SGP30 is connected to.
48+
:param int address: The I2C address of the device. Defaults to :const:`0x58`
49+
50+
51+
**Quickstart: Importing and using the SGP30 temperature sensor**
52+
53+
Here is one way of importing the `Adafruit_SGP30` class so you
54+
can use it with the name ``sgp30``.
55+
First you will need to import the libraries to use the sensor
56+
57+
.. code-block:: python
58+
59+
import busio
60+
import board
61+
import adafruit_sgp30
62+
63+
Once this is done you can define your `busio.I2C` object and define your sensor object
64+
65+
.. code-block:: python
66+
67+
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
68+
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)
69+
70+
Now you have access to the Carbon Dioxide Equivalent baseline using the
71+
:attr:`baseline_eCO2` attribute and the Total Volatile Organic Compound
72+
baseline using the :attr:`baseline_TVOC`
73+
74+
.. code-block:: python
75+
76+
eCO2 = sgp30.baseline_eCO2
77+
TVOC = sgp30.baseline_TVOC
78+
79+
4680
"""
4781

4882
def __init__(self, i2c, address=_SGP30_DEFAULT_I2C_ADDR):

0 commit comments

Comments
 (0)