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
5import board
6import adafruit_am2320
7
8# create the I2C shared bus
9i2c = board.I2C() # uses board.SCL and board.SDA
10# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
11am = adafruit_am2320.AM2320(i2c)
12
13while True:
14 print("Temperature: ", am.temperature)
15 print("Humidity: ", am.relative_humidity)
16 time.sleep(2)