Skip to content

Commit e5af7e2

Browse files
committed
added index
1 parent 791e169 commit e5af7e2

File tree

3 files changed

+40
-520
lines changed

3 files changed

+40
-520
lines changed

README.rst

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
Introduction
22
============
33

4-
This fork adds DFRobots VOC Index algorithm to adafruits CircuitPython SGP40 library.
4+
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-sgp40/badge/?version=latest
5+
:target: https://circuitpython.readthedocs.io/projects/sgp40/en/latest/
6+
:alt: Documentation Status
57

6-
CircuitPython library for the Adafruit SGP40 Air Quality Sensor / VOC Index Sensor Breakouts.
8+
.. image:: https://img.shields.io/discord/327254708534116352.svg
9+
:target: https://adafru.it/discord
10+
:alt: Discord
711

8-
* `Original Library <https://github.com/adafruit/Adafruit_CircuitPython_SGP40>`_
9-
* `DFRobot Algorithm <https://github.com/DFRobot/DFRobot_SGP40>`_
12+
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_SGP40/workflows/Build%20CI/badge.svg
13+
:target: https://github.com/adafruit/Adafruit_CircuitPython_SGP40/actions
14+
:alt: Build Status
15+
16+
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
17+
:target: https://github.com/psf/black
18+
:alt: Code Style: Black
19+
20+
CircuitPython library for the Adafruit SGP40 Air Quality Sensor / VOC Index Sensor Breakouts
1021

1122

1223
Dependencies
@@ -17,7 +28,6 @@ This driver depends on:
1728
* `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
1829
* `Register <https://github.com/adafruit/Adafruit_CircuitPython_Register>`_
1930

20-
2131
Please ensure all dependencies are available on the CircuitPython filesystem.
2232
This is easily achieved by downloading
2333
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.
@@ -50,6 +60,20 @@ To install in a virtual environment in your current project:
5060
Usage Example
5161
=============
5262

63+
.. code-block:: python3
64+
65+
import time
66+
import board
67+
import adafruit_sgp40
68+
69+
i2c = board.I2C() # uses board.SCL and board.SDA
70+
sgp = adafruit_sgp40(i2c)
71+
72+
while True:
73+
print("Measurement: ", sgp.raw)
74+
print("")
75+
sleep(1)
76+
5377
For humidity compensated raw gas and voc index readings, we'll need a secondary sensor such as the bme280
5478

5579
.. code-block:: python3
@@ -67,10 +91,10 @@ For humidity compensated raw gas and voc index readings, we'll need a secondary
6791
temperature = bme280.temperature
6892
humidity = bme280.relative_humidity
6993
70-
# Compensated raw gas reading
94+
# For compensated raw gas readings
7195
compensated_raw_gas = sgp.measure_index(temperature = temperature, relative_humidity = humidity)
7296
73-
# Compensated voc index reading
97+
# For Compensated voc index readings
7498
voc_index = sgp.measure_raw(temperature = temperature, relative_humidity = humidity)
7599
76100
print(compensated_raw_gas)

0 commit comments

Comments
 (0)