Driver for SCD30 CO2 Sensor
Posted: Sun Jan 10, 2021 12:26 pm
Hey,
I want to read a SCD30 CO2 Sensor with an ESP32.
I found this driver: https://github.com/agners/micropython-scd30
Trying the example:
doesn't work:
not a surprise because the variable i2c is not defined. How can I do that? I didn't find anything in the readme.
I want to read a SCD30 CO2 Sensor with an ESP32.
I found this driver: https://github.com/agners/micropython-scd30
Trying the example:
Code: Select all
import time
from machine import I2C, Pin
from scd30 import SCD30
i2cbus = I2C(1)
scd30 = SCD30(i2c, 0x61)
while True:
# Wait for sensor data to be ready to read (by default every 2 seconds)
while scd30.get_status_ready() != 1:
time.sleep_ms(200)
scd30.read_measurement()
Code: Select all
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
NameError: name 'i2c' isn't defined