### Install adafruit-circuitpython-ina3221 using pip Source: https://adafruit-circuitpython-ina3221.readthedocs.io/en/latest Install the driver locally from PyPI using pip3. This command installs for the current user. ```bash pip3 install adafruit-circuitpython-ina3221 ``` -------------------------------- ### Install adafruit-circuitpython-ina3221 in a virtual environment Source: https://adafruit-circuitpython-ina3221.readthedocs.io/en/latest Install the driver in a virtual environment for a specific project. This involves creating a virtual environment, activating it, and then installing the library. ```bash mkdir project-name && cd project-name python3 -m venv .venv source .env/bin/activate pip3 install adafruit-circuitpython-ina3221 ``` -------------------------------- ### Install adafruit-circuitpython-ina3221 system-wide using pip Source: https://adafruit-circuitpython-ina3221.readthedocs.io/en/latest Install the driver system-wide using pip3. This may be required in some cases. ```bash sudo pip3 install adafruit-circuitpython-ina3221 ``` -------------------------------- ### Install circup Source: https://adafruit-circuitpython-ina3221.readthedocs.io/en/latest Install the circup tool, which is used to manage libraries on CircuitPython devices. This command installs circup in the current Python environment. ```bash pip3 install circup ``` -------------------------------- ### Install adafruit-circuitpython-ina3221 using circup Source: https://adafruit-circuitpython-ina3221.readthedocs.io/en/latest Install the driver onto a connected CircuitPython device using the circup tool. Ensure your device is connected and recognized. ```bash circup install adafruit_ina3221 ``` -------------------------------- ### Read voltage and current from INA3221 sensor Source: https://adafruit-circuitpython-ina3221.readthedocs.io/en/latest This example demonstrates how to read bus voltage, shunt voltage, and current from the INA3221 sensor. It iterates through the three available channels and prints the readings every two seconds. ```python import time import board from adafruit_ina3221 import INA3221 i2c = board.I2C() ina = INA3221(i2c) while True: for i in range(3): bus_voltage = ina[i].bus_voltage shunt_voltage = ina[i].shunt_voltage current = ina[i].current_amps * 1000 print(f"Channel {i + 1}:") print(f" Bus Voltage: {bus_voltage:.6f} V") print(f" Shunt Voltage: {shunt_voltage:.6f} V") print(f" Current: {current:.6f} mA") print("-" * 30) time.sleep(2) ``` -------------------------------- ### Update adafruit-circuitpython-ina3221 using circup Source: https://adafruit-circuitpython-ina3221.readthedocs.io/en/latest Update an existing installation of the driver on a connected CircuitPython device using the circup tool. ```bash circup update ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.