While I was working on a PR for this repo, I noticed that the first read after each save (and thus reload) was giving good temperature and humidity, but 0 as the CO2 reading. (CLUE running 6.1.0) Not sure if this is expected or not, and whether it's best to deal with just by intentionally dropping the first data_available on the floor, or if there's something else going on.
For reference, a stripped-down copy of my code is here:
# Copyright 2021, Ryan Pavlik <ryan.pavlik@gmail.com>
# SPDX-License-Identifier: Unlicense
from adafruit_clue import clue
from adafruit_scd30 import SCD30
import board
import time
i2c = board.I2C()
try:
scd = SCD30(i2c)
have_scd = True
scd.measurement_interval = 5
except ValueError:
have_scd = False
def c_to_f(temp):
return temp * 1.8 + 32
clue_data = clue.simple_text_display(text_scale=2)
last_co2 = "No CO2 meas"
while True:
clue_data[0].text = "Pressure: {:.3f}hPa".format(clue.pressure)
# PM25 sensor reads removed here
clue_data.show()
if have_scd and scd.data_available:
clue_data[1].text = "{:.1f}F, {:.1f}%RH".format(c_to_f(scd.temperature), scd.relative_humidity)
last_co2 = "CO2: {} PPM".format(scd.co2)
clue_data[2].text = last_co2
time.sleep(5)
While I was working on a PR for this repo, I noticed that the first read after each save (and thus reload) was giving good temperature and humidity, but 0 as the CO2 reading. (CLUE running 6.1.0) Not sure if this is expected or not, and whether it's best to deal with just by intentionally dropping the first data_available on the floor, or if there's something else going on.
For reference, a stripped-down copy of my code is here: