Skip to content

Commit

Permalink
ujson.loads for baseline import in readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasticdonkey committed May 4, 2020
1 parent 6e29fbd commit 9e085ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,17 @@ Baselines calculated by the SGP30 sensor during the course of its operation can

.. code-block:: python
import ujson
BASELINE_FILE = "sgp30_iaq_baseline.txt"
current_baseline = sgp30.get_iaq_baseline()
with open(BASELINE_FILE, "w") as file:
file.write(current_baseline)
file.write(str(current_baseline))
# After power up / soft reset...
with open(BASELINE_FILE, "r") as file:
current_baseline = file.read()
current_baseline = ujson.loads(file.read())
sgp30.set_iaq_baseline(current_baseline)
Testing
Expand Down

0 comments on commit 9e085ed

Please sign in to comment.