Lesson 1 of 0
In Progress

LESSON 2 SOFTWARE

Firstly, we need to install the i2c tools to manage the i2c bus

sudo apt-get install i2c-tools
import time
import board
import busio
import adafruit_scd30
from datetime import datetime

i2c = busio.I2C(board.SCL, board.SDA, frequency=50000)
scd = adafruit_scd30.SCD30(i2c)

time.sleep(5)

if scd.data_available:
    now = datetime.now() # current date and time
    current_time = now.strftime("%m/%d/%Y, %H:%M:%S")
    print(current_time + "; CO2: " + str(round(scd.CO2,2)) + " PPM; Temperature: " + str(round(scd.temperature,2)) + " ÂșC; " + "Humidity: " + str(round(scd.relative_humidity,2)) + " %.")