}
// found lc709203f!
else {
addr0x36 = false;
Serial.println(F("Found LC709203F"));
Serial.print("Version: 0x"); Serial.println(lc.getICversion(), HEX);
lc.setThermistorB(3950);
Serial.print("Thermistor B = "); Serial.println(lc.getThermistorB());
lc.setPackSize(LC709203F_APA_500MAH);
lc.setAlarmVoltage(3.8);
}
// found max17048!
}
else {
addr0x36 = true;
Serial.print(F("Found MAX17048"));
Serial.print(F(" with Chip ID: 0x"));
Serial.println(maxlipo.getChipID(), HEX);
}
}
void loop() {
// if you have the max17048..
if (addr0x36 == true) {
max17048();
}
// if you have the lc709203f..
else {
lc709203f();
}
delay(2000);
// dont query too often!
}
void lc709203f() {
Serial.print("Batt_Voltage:");
Serial.print(lc.cellVoltage(), 3);
Serial.print("\t");
Serial.print("Batt_Percent:");
Serial.print(lc.cellPercent(), 1);
Serial.print("\t");
Serial.print("Batt_Temp:");
Serial.println(lc.getCellTemperature(), 1);
}
void max17048() {
Serial.print(F("Batt Voltage: ")); Serial.print(maxlipo.cellVoltage(), 3);
Serial.println(" V");
Serial.print(F("Batt Percent: ")); Serial.print(maxlipo.cellPercent(), 1);
Serial.println(" %");
Serial.println();
}
For CircuitPython, you can measure it like this.
# SPDX-FileCopyrightText: Copyright (c) 2023 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
import time
import board
from adafruit_max1704x import MAX17048
from adafruit_lc709203f import LC709203F, PackSize
#
©Adafruit Industries
Page 33 of 263
Need help?
Do you have a question about the ESP32-S3 and is the answer not in the manual?