Skip to content

Commit 2ef26a0

Browse files
Merge pull request #45 from jposada202020/improving_docs
improving_docs
2 parents fcf4b69 + 122d6b4 commit 2ef26a0

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ Next, initialize the I2C bus object.
7171
.. code:: python
7272
7373
from board import *
74-
i2c_bus = busio.I2C(SCL, SDA)
74+
i2c = board.I2C() # uses board.SCL and board.SDA
7575
7676
Once you have created the I2C interface object, you can use it to instantiate
7777
the CCS811 object
7878

7979
.. code:: python
8080
81-
ccs = adafruit_ccs811.CCS811(i2c_bus)
81+
ccs = adafruit_ccs811.CCS811(i2c)
8282
8383
Reading Sensor
8484
--------------

adafruit_ccs811.py

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,25 @@
33
# SPDX-License-Identifier: MIT
44

55
"""
6-
`CCS811` - Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2
6+
`adafruit_ccs811`
77
======================================================================
88
This library supports the use of the CCS811 air quality sensor in CircuitPython.
99
1010
Author(s): Dean Miller for Adafruit Industries
1111
12+
**Hardware:**
13+
14+
* `Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2
15+
<https://www.adafruit.com/product/3566>`_
16+
17+
**Software and Dependencies:**
18+
19+
* Adafruit CircuitPython firmware for the supported boards:
20+
https://github.com/adafruit/circuitpython/releases
21+
22+
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
23+
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
24+
1225
**Notes:**
1326
1427
#. `Datasheet
@@ -61,8 +74,33 @@
6174
class CCS811:
6275
"""CCS811 gas sensor driver.
6376
64-
:param ~busio.I2C i2c: The I2C bus.
65-
:param int addr: The I2C address of the CCS811.
77+
:param ~busio.I2C i2c_bus: The I2C bus the BME280 is connected to
78+
:param int address: The I2C address of the CCS811. Defaults to :const:`0x5A`
79+
80+
**Quickstart: Importing and using the CCS811**
81+
82+
Here is an example of using the :class:`CCS811` class.
83+
First you will need to import the libraries to use the sensor
84+
85+
.. code-block:: python
86+
87+
import board
88+
import adafruit_ccs811
89+
90+
Once this is done you can define your `board.I2C` object and define your sensor object
91+
92+
.. code-block:: python
93+
94+
i2c = board.I2C() # uses board.SCL and board.SDA
95+
ccs811 = adafruit_ccs811.CCS811(i2c)
96+
97+
Now you have access to the :attr:`eco2` and :attr:`tvoc` attributes.
98+
99+
.. code-block:: python
100+
101+
eco2 = ccs811.eco2
102+
tvoc = ccs811.tvoc
103+
66104
"""
67105

68106
# set up the registers
@@ -142,7 +180,7 @@ def _update_data(self):
142180
@property
143181
def baseline(self):
144182
"""
145-
The propery reads and returns the current baseline value.
183+
The property reads and returns the current baseline value.
146184
The returned value is packed into an integer.
147185
Later the same integer can be used in order
148186
to set a new baseline.

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2 Learning Guide <https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

examples/ccs811_simpletest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
import time
55
import board
6-
import busio
76
import adafruit_ccs811
87

9-
i2c = busio.I2C(board.SCL, board.SDA)
8+
i2c = board.I2C() # uses board.SCL and board.SDA
109
ccs811 = adafruit_ccs811.CCS811(i2c)
1110

1211
# Wait for the sensor to be ready

0 commit comments

Comments
 (0)