Skip to content

Commit

Permalink
Merge pull request #10 from AVanVlack/main
Browse files Browse the repository at this point in the history
Blinka import
  • Loading branch information
caternuson authored Sep 6, 2021
2 parents cf90d93 + d74daa0 commit c07f439
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
18 changes: 11 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,20 +92,24 @@ For humidity compensated raw gas and voc index readings, we'll need a secondary
humidity = bme280.relative_humidity
# For compensated raw gas readings
compensated_raw_gas = sgp.measure_raw(temperature = temperature, relative_humidity = humidity)
time.sleep(1)
"""
compensated_raw_gas = sgp.measure_raw(
temperature=temperature, relative_humidity=humidity
)
print("Raw Data:", compensated_raw_gas)
"""
# For Compensated voc index readings
voc_index = sgp.measure_index(temperature = temperature, relative_humidity = humidity)
voc_index = sgp.measure_index(
temperature=temperature, relative_humidity=humidity)
print(compensated_raw_gas)
print(voc_index)
print("VOC Index:", voc_index)
print("")
time.sleep(1)
It may take several minutes for the VOC index to start changing as it calibrates the baseline readings.
The voc algorithm expects a 1 hertz sampling rate. Run `measure_index()` once per second.


Contributing
============
Expand Down
1 change: 1 addition & 0 deletions adafruit_sgp40/voc_algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Author(s): yangfeng
"""
from micropython import const

_VOCALGORITHM_SAMPLING_INTERVAL = const(1)
_VOCALGORITHM_INITIAL_BLACKOUT = const(45)
Expand Down
7 changes: 4 additions & 3 deletions examples/sgp40_indextest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
humidity = bme280.relative_humidity

# For compensated raw gas readings
"""
compensated_raw_gas = sgp.measure_raw(
temperature=temperature, relative_humidity=humidity
)

time.sleep(1)
print("Raw Data:", compensated_raw_gas)
"""

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

print("Raw Data:", compensated_raw_gas)
print("VOC Index:", voc_index)
print("")
time.sleep(1)

0 comments on commit c07f439

Please sign in to comment.