Reading XIAO VIN value to alert when Cr2032 is dead?

Hello,

I am planning to have a red led light ON when VIN voltage is going below 2.98V.

Does anyone know, using an arduino sketch, the necessary code line for reading VIN value ?

Thank you

A similar question was raised by a customer before. If the voltage value is read in the state of battery loss, you may get 3.3V, which is inaccurate and cannot be achieved.