diff --git a/README.rst b/README.rst index 72eef5b..df75950 100644 --- a/README.rst +++ b/README.rst @@ -23,10 +23,42 @@ Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading `the Adafruit library and driver bundle `_. -Usage Example +Usage Notes ============= -TODO +See `the guide `_ +for wiring and installation instructions. + +First, import the library: + +.. code-block:: python + + import busio + import adafruit_sgp30 + +Next, initialize the I2C bus object: + +.. code-block:: python + + from board import * + i2c_bus = busio.I2C(board.SCL, board.SDA, frequency=100000) + +Since we have the I2C bus object, we can now use it to instantiate the SGP30 object: + +.. code-block:: python + + sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c_bus) + +Reading from the Sensor +-------------- + +To read from the sensor: + +.. code-block:: python + + co2eq, tvoc = sgp30.iaq_measure() + print("CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc)) + API Reference ============= diff --git a/conf.py b/conf.py index 5303696..72a11cb 100644 --- a/conf.py +++ b/conf.py @@ -18,7 +18,7 @@ # Uncomment the below if you use native CircuitPython modules such as # digitalio, micropython and busio. List the modules you use. Without it, the # autodoc module docs will fail to generate with a warning. -# autodoc_mock_imports = ["digitalio", "busio"] +autodoc_mock_imports = ["adafruit_bus_device", "micropython"] intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/bus_device/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}