Simple test
Ensure your device works with this simple test.
examples/ina260_simpletest.py
1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2# SPDX-License-Identifier: MIT
3
4import time
5import board
6import adafruit_ina260
7
8i2c = board.I2C() # uses board.SCL and board.SDA
9# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
10ina260 = adafruit_ina260.INA260(i2c)
11while True:
12 print(
13 "Current: %.2f mA Voltage: %.2f V Power:%.2f mW"
14 % (ina260.current, ina260.voltage, ina260.power)
15 )
16 time.sleep(1)