File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -31,27 +31,31 @@ for wiring and installation instructions.
31
31
32
32
First, import the library:
33
33
34
- .. code :: python
34
+ .. code-block :: python
35
+
35
36
import busio
36
37
import adafruit_sgp30
37
38
38
39
Next, initialize the I2C bus object:
39
40
40
- .. code :: python
41
+ .. code-block :: python
42
+
41
43
from board import *
42
44
i2c_bus = busio.I2C(board.SCL , board.SDA , frequency = 100000 )
43
45
44
46
Since we have the I2C bus object, we can now use it to instantiate the SGP30 object:
45
47
46
- .. code :: python
48
+ .. code-block :: python
49
+
47
50
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c_bus)
48
51
49
52
Reading from the Sensor
50
53
--------------
51
54
52
55
To read from the sensor:
53
56
54
- .. code :: python
57
+ .. code-block :: python
58
+
55
59
co2eq, tvoc = sgp30.iaq_measure()
56
60
print (" CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc))
57
61
You can’t perform that action at this time.
0 commit comments