Skip to content

Commit a8213c4

Browse files
authored
Merge pull request #3 from jposada202020/improving_docs
Improving docs
2 parents 9467b56 + e0c1208 commit a8213c4

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

adafruit_sgp40.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@
1515
1616
**Hardware:**
1717
18-
* Adafruit SGP40 Breakout <https://www.adafruit.com/product/4829>
18+
* Adafruit SGP40 Air Quality Sensor Breakout - VOC Index <https://www.adafruit.com/product/4829>
1919
2020
**Software and Dependencies:**
2121
2222
* Adafruit CircuitPython firmware for the supported boards:
2323
https://github.com/adafruit/circuitpython/releases
2424
2525
26-
2726
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2827
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
2928
@@ -41,7 +40,39 @@
4140

4241

4342
class SGP40:
44-
"""Class to use the SGP40 Ambient Light and UV sensor"""
43+
"""
44+
Class to use the SGP40 Ambient Light and UV sensor
45+
46+
:param ~busio.I2C i2c: The I2C bus the SGP40 is connected to.
47+
:param int address: The I2C address of the device. Defaults to :const:`0x59`
48+
49+
50+
**Quickstart: Importing and using the SGP40 temperature sensor**
51+
52+
Here is one way of importing the `SGP40` class so you can use it with the name ``sgp``.
53+
First you will need to import the libraries to use the sensor
54+
55+
.. code-block:: python
56+
57+
import busio
58+
import board
59+
import adafruit_sgp40
60+
61+
Once this is done you can define your `busio.I2C` object and define your sensor object
62+
63+
.. code-block:: python
64+
65+
i2c = busio.I2C(board.SCL, board.SDA)
66+
sgp = adafruit_sgp40.SGP40(i2c)
67+
68+
Now you have access to the raw gas value using the :attr:`raw` attribute
69+
70+
.. code-block:: python
71+
72+
raw_gas_value = sgp.raw
73+
74+
75+
"""
4576

4677
def __init__(self, i2c, address=0x59):
4778
self.i2c_device = i2c_device.I2CDevice(i2c, address)

0 commit comments

Comments
 (0)