Is there any API or function or library to measure battery voltage?
Is there any API or function or library to measure battery voltage?
Hello,
As Awneil suggests, you could use the SAADC peripheral to do this.
We do not have an example on this directly, but battery measurement is implemented as part of the BLE Peripheral Proximity example, where you can see how to configure the SAADC to perform the measurements.
Alternatively, you could modify the SAADC peripheral example by changing the parameter supplied to NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0).
The SAADC example prints its measurements using UART, which might make the latter the simplest approach.
You can view the complete SAADC API Reference here.
Best regards,
Karl