Skip to content

Commit 3eb9a73

Browse files
committed
markdown?
1 parent 5364778 commit 3eb9a73

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

README.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Introduction
1010
:target: https://discord.gg/nBQh6qu
1111
:alt: Discord
1212
13-
TODO
13+
This is a CircuitPython driver for the Sensirion SGP30 air quality sensor, it can provide CO2eq (equivalent CO2) and TVOC (Total Volatile Organic Compounds) with a simple I2C interface
1414

1515
Dependencies
1616
=============
@@ -26,7 +26,25 @@ This is easily achieved by downloading
2626
Usage Example
2727
=============
2828

29-
TODO
29+
```
30+
import board
31+
import busio
32+
import time
33+
import adafruit_sgp30
34+
35+
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
36+
37+
# Create library object on our I2C port
38+
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)
39+
40+
print("SGP30 serial #", [hex(i) for i in sgp30._serial])
41+
42+
sgp30.sgp_iaq_init()
43+
while True:
44+
co2eq, tvoc = sgp30.sgp_iaq_measure()
45+
print("CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc))
46+
time.sleep(1)
47+
```
3048

3149
Contributing
3250
============

0 commit comments

Comments
 (0)