Simple test

Ensure your device works with this simple test.

examples/am2320_simpletest.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import time
import board
import busio
import adafruit_am2320

# create the I2C shared bus
i2c = busio.I2C(board.SCL, board.SDA)
am = adafruit_am2320.AM2320(i2c)

while True:
    print("Temperature: ", am.temperature)
    print("Humidity: ", am.relative_humidity)
    time.sleep(2)