From 76cd1504caf380d9d3ce3cd9d099ccbc4ce06adb Mon Sep 17 00:00:00 2001 From: Mikhail Grushinskiy Date: Sun, 15 Dec 2024 21:42:23 -0500 Subject: [PATCH] Update bbn_m5atomS3_lite_INA219.ino --- .../bbn_m5atomS3_lite_INA219.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bbn_m5atomS3_lite_INA219/bbn_m5atomS3_lite_INA219.ino b/bbn_m5atomS3_lite_INA219/bbn_m5atomS3_lite_INA219.ino index 5c30061..441228b 100644 --- a/bbn_m5atomS3_lite_INA219/bbn_m5atomS3_lite_INA219.ino +++ b/bbn_m5atomS3_lite_INA219/bbn_m5atomS3_lite_INA219.ino @@ -8,7 +8,7 @@ #define INA219_I2C_ADDRESS_2 (0x44) // Bridge A1 (on addresses pad) #define INA219_I2C_ADDRESS_3 (0x45) // Bridge A0 and A1 (on addresses pad) -Adafruit_INA219 ina219(INA219_I2C_ADDRESS_0); +Adafruit_INA219 ina219_0(INA219_I2C_ADDRESS_0); unsigned long timeout = 0; void setup() { @@ -16,7 +16,7 @@ void setup() { AtomS3.begin(cfg); Serial.begin(4800); Wire.begin(G2, G1, 100000UL); - if (!ina219.begin()) { + if (!ina219_0.begin()) { //Serial.println("Failed to find INA219 chip"); while (1) { delay(10); @@ -28,16 +28,16 @@ void setup() { range can't measure as large of values but will measure with slightly better precision. */ - //ina219.setCalibration_32V_1A(); - //ina219.setCalibration_16V_400mA(); + //ina219_0.setCalibration_32V_1A(); + //ina219_0.setCalibration_16V_400mA(); } void loop() { if (timeout < millis()) { // Read voltage and current from INA219. - float shuntvoltage = ina219.getShuntVoltage_mV(); - float busvoltage = ina219.getBusVoltage_V(); - float current_mA = ina219.getCurrent_mA(); + float shuntvoltage = ina219_0.getShuntVoltage_mV(); + float busvoltage = ina219_0.getBusVoltage_V(); + float current_mA = ina219_0.getCurrent_mA(); // Compute load voltage, power, and milliamp-hours. float loadvoltage = busvoltage + (shuntvoltage / 1000);