idf.py add-dependency "cybergear-robotics/ina226"ESP-IDF 5.2 or newer is required. Configure an I2C master bus and add the
INA226 as an I2C device using driver/i2c_master.h, then pass the resulting
device handle through ina226_config_t.i2c_dev. The example below shows the
complete setup.
Not all examples are ported. For further examples, please look at the original project.
- create example project
idf.py create-project-from-example "cybergear-robotics/ina226:read_voltage"- Go to to example directory (for example
read_voltage)cd read_voltage - Set ESP chip
idf.py set-target esp32 - Configure I2C settings
idf.py menuconfig - Build, flash
idf.py build flash monitor
The Unity hardware test is self-contained in test/ and uses I2C port 0, SCL GPIO 11,
and SDA GPIO 12 by default. It expects 24.0 V on the INA226 bus input, with a 0.5 V
tolerance. All values can be changed with idf.py menuconfig.
Run it from the component repository:
idf.py -C test_app build flash monitor