Skip to content

Commit 5364778

Browse files
committed
demo working
1 parent 90f8cfe commit 5364778

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

examples/sgp30_test.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@
88
# Create library object on our I2C port
99
sgp30 = adafruit_sgp30.Adafruit_SGP30(i2c)
1010

11+
print("SGP30 serial #", [hex(i) for i in sgp30._serial])
12+
1113
sgp30.sgp_iaq_init()
14+
sgp30.sgp_set_iaq_baseline(0x8973, 0x8aae)
15+
16+
elapsed_sec = 0
1217

1318
while True:
1419
co2eq, tvoc = sgp30.sgp_iaq_measure()
1520
print("CO2eq = %d ppm \t TVOC = %d ppb" % (co2eq, tvoc))
16-
time.sleep(5)
21+
time.sleep(1)
22+
elapsed_sec += 1
23+
if elapsed_sec > 10:
24+
elapsed_sec = 0
25+
co2eq_base, tvoc_base = sgp30.sgp_get_iaq_baseline()
26+
print("**** Baseline values: CO2eq = 0x%x, TVOC = 0x%x" % (co2eq_base, tvoc_base))

0 commit comments

Comments
 (0)