Core2: Python API to get battery charge level
Is there a Python API to get battery charge level for the Core2 battery?
I found power.getChargeState() but it just returns true/false (charging/discharging). There is also power.getBatVoltage() which could be an indication of the charge level but would need some additional math to calculate the percentage.
robalstona last edited by
I found table with voltage and according percentage on internet and make this code
ewentually you could calculate with formula something like this, but it is not accurate.
percentage = int( (battery_voltage - 3.20) * 100)
I see that your code applies to the M5stickC. Do you think the table is the same for the M5 Core2?
robalstona last edited by robalstona
Should work if you replace line
volt = axp.getBatVoltage()
volt = power.getBatVoltage()
Battery discharge characteristics should be the same +/- some small variations independently of battery capacity.
Thanks. I checked on the Core2 and here battery voltage also ranges from about 3.2V to 4.2V.