Simple test¶
Ensure your device works with this simple test.
1# SPDX-FileCopyrightText: 2020 by Bryan Siepert for Adafruit Industries
2#
3# SPDX-License-Identifier: Unlicense
4import time
5import board
6import adafruit_sgp40
7
8# If you have a temperature sensor, like the bme280, import that here as well
9# import adafruit_bme280
10
11i2c = board.I2C() # uses board.SCL and board.SDA
12sgp = adafruit_sgp40.SGP40(i2c)
13# And if you have a temp/humidity sensor, define the sensor here as well
14# bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)
15
16while True:
17 print("Raw Gas: ", sgp.raw)
18 # Lets quickly grab the humidity and temperature
19 # temperature = bme280.temperature
20 # humidity = bme280.relative_humidity
21 # compensated_raw_gas = sgp.measure_raw(temperature = temperature, relative_humidity = humidity)
22 print("")
23 time.sleep(1)