Simple test
Ensure your device works with this simple test.
examples/am2320_simpletest.py
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4import time
5
6import board
7
8import adafruit_am2320
9
10# create the I2C shared bus
11i2c = board.I2C() # uses board.SCL and board.SDA
12# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
13am = adafruit_am2320.AM2320(i2c)
14
15while True:
16 print("Temperature: ", am.temperature)
17 print("Humidity: ", am.relative_humidity)
18 time.sleep(2)