How to get the battery percentage of Xiao Esp32c

I have connected a 3.7v lipo battery to the Xiao Esp32c, and was wondering if it is possible to read its battery percentage.


You need to connect the battery to the analog pins for testing.

Because VBAT voltage cannot be read directly, It will be necessary to divide the voltage so that it does not exceed 2.5V and connect it to a port pin.

Oh okay, so there is no inbuilt way to read the battery percentage?

I think this method will work too: Getting the ESP32 to monitor its own battery level (for battery powered projects) - YouTube