Simple test

Ensure your device works with this simple test.

examples/ina3221_simpletest.py
 1# SPDX-FileCopyrightText: Copyright (c) 2024 Liz Clark for Adafruit Industries
 2#
 3# SPDX-License-Identifier: MIT
 4import time
 5
 6import board
 7
 8from adafruit_ina3221 import INA3221
 9
10i2c = board.I2C()
11ina = INA3221(i2c, enable=[0, 1, 2])
12
13while True:
14    for i in range(3):
15        bus_voltage = ina[i].bus_voltage
16        shunt_voltage = ina[i].shunt_voltage
17        current = ina[i].current
18
19        print(f"Channel {i + 1}:")
20        print(f"  Bus Voltage: {bus_voltage:.6f} V")
21        print(f"  Shunt Voltage: {shunt_voltage:.6f} mV")
22        print(f"  Current: {current:.6f} mA")
23        print("-" * 30)
24
25    time.sleep(2)