Skip to content

Commit c07f439

Browse files
authored
Merge pull request #10 from AVanVlack/main
Blinka import
2 parents cf90d93 + d74daa0 commit c07f439

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

README.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,24 @@ For humidity compensated raw gas and voc index readings, we'll need a secondary
9292
humidity = bme280.relative_humidity
9393
9494
# For compensated raw gas readings
95-
compensated_raw_gas = sgp.measure_raw(temperature = temperature, relative_humidity = humidity)
96-
97-
time.sleep(1)
95+
"""
96+
compensated_raw_gas = sgp.measure_raw(
97+
temperature=temperature, relative_humidity=humidity
98+
)
99+
print("Raw Data:", compensated_raw_gas)
100+
"""
98101
99102
# For Compensated voc index readings
100-
voc_index = sgp.measure_index(temperature = temperature, relative_humidity = humidity)
103+
voc_index = sgp.measure_index(
104+
temperature=temperature, relative_humidity=humidity)
101105
102-
print(compensated_raw_gas)
103-
print(voc_index)
106+
print("VOC Index:", voc_index)
104107
print("")
105108
time.sleep(1)
106109
107-
108110
It may take several minutes for the VOC index to start changing as it calibrates the baseline readings.
111+
The voc algorithm expects a 1 hertz sampling rate. Run `measure_index()` once per second.
112+
109113

110114
Contributing
111115
============

adafruit_sgp40/voc_algorithm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Author(s): yangfeng
1212
1313
"""
14+
from micropython import const
1415

1516
_VOCALGORITHM_SAMPLING_INTERVAL = const(1)
1617
_VOCALGORITHM_INITIAL_BLACKOUT = const(45)

examples/sgp40_indextest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@
1818
humidity = bme280.relative_humidity
1919

2020
# For compensated raw gas readings
21+
"""
2122
compensated_raw_gas = sgp.measure_raw(
2223
temperature=temperature, relative_humidity=humidity
2324
)
24-
25-
time.sleep(1)
25+
print("Raw Data:", compensated_raw_gas)
26+
"""
2627

2728
# For Compensated voc index readings
29+
# The algorithm expects a 1 hertz sampling rate. Run "measure index" once per second.
2830
# It may take several minutes for the VOC index to start changing
2931
# as it calibrates the baseline readings.
3032
voc_index = sgp.measure_index(temperature=temperature, relative_humidity=humidity)
3133

32-
print("Raw Data:", compensated_raw_gas)
3334
print("VOC Index:", voc_index)
3435
print("")
3536
time.sleep(1)

0 commit comments

Comments
 (0)