XIAO BLE Sense battery level and charging status

Hi Folks (Experts)…

I came to this thread , wanting to read Read Battery voltage, Turn on LED when charging and Turn on LED to a different color when not charging)…

Unfortunately, I was not able to decipher all the discussions and make a conclusion. How to do it?
Can anyone please help with an example and Library/Board version that i need to use to accomplish the above?

i am using XIOA BLE SENSE board.
Using 2.9.2 Board version.

What exactly The code i should use?

Appreciate your help…
thanks
Outkast