Skip to content

Improving docs #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions adafruit_sgp40.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@

**Hardware:**

* Adafruit SGP40 Breakout <https://www.adafruit.com/product/4829>
* Adafruit SGP40 Air Quality Sensor Breakout - VOC Index <https://www.adafruit.com/product/4829>

**Software and Dependencies:**

* 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
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register

Expand All @@ -41,7 +40,39 @@


class SGP40:
"""Class to use the SGP40 Ambient Light and UV sensor"""
"""
Class to use the SGP40 Ambient Light and UV sensor

:param ~busio.I2C i2c: The I2C bus the SGP40 is connected to.
:param int address: The I2C address of the device. Defaults to :const:`0x59`


**Quickstart: Importing and using the SGP40 temperature sensor**

Here is one way of importing the `SGP40` class so you can use it with the name ``sgp``.
First you will need to import the libraries to use the sensor

.. code-block:: python

import busio
import board
import adafruit_sgp40

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)
sgp = adafruit_sgp40.SGP40(i2c)

Now you have access to the raw gas value using the :attr:`raw` attribute

.. code-block:: python

raw_gas_value = sgp.raw


"""

def __init__(self, i2c, address=0x59):
self.i2c_device = i2c_device.I2CDevice(i2c, address)
Expand Down