Skip to content

Blinka import #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)