Skip to content

Commit

Permalink
Merge pull request #33 from jposada202020/improving_docs
Browse files Browse the repository at this point in the history
Improving docs
  • Loading branch information
ladyada authored Apr 17, 2021
2 parents e54f975 + b398123 commit fc8f1f7
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion adafruit_sgp30.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
**Software and Dependencies:**
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
"""
Expand All @@ -43,6 +43,40 @@
class Adafruit_SGP30:
"""
A driver for the SGP30 gas sensor.
:param ~busio.I2C i2c: The I2C bus the SGP30 is connected to.
:param int address: The I2C address of the device. Defaults to :const:`0x58`
**Quickstart: Importing and using the SGP30 temperature sensor**
Here is one way of importing the `Adafruit_SGP30` class so you
can use it with the name ``sgp30``.
First you will need to import the libraries to use the sensor
.. code-block:: python
import busio
import board
import adafruit_sgp30
Once this is done you can define your `busio.I2C` object and define your sensor object
.. code-block:: python
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)
Now you have access to the Carbon Dioxide Equivalent baseline using the
:attr:`baseline_eCO2` attribute and the Total Volatile Organic Compound
baseline using the :attr:`baseline_TVOC`
.. code-block:: python
eCO2 = sgp30.baseline_eCO2
TVOC = sgp30.baseline_TVOC
"""

def __init__(self, i2c, address=_SGP30_DEFAULT_I2C_ADDR):
Expand Down

0 comments on commit fc8f1f7

Please sign in to comment.