Battery Status Example¶
The Battery Status Example shows how to get the status of the battery charger, including the battery level, charging state and power source.
The example initializes the SAADC driver and configures one channel to sample the voltage of the battery. Application Timer module is used to generate a timeout event. When the timer expires, the callback function will be called to print the measurement.
Before you start building, remember to set up the nRF5 SDK development environment first. See Setup the nRF5 SDK for details.
Building the example¶
You can find the source code and the project file of the example in the following folder: pitaya-go/examples/peripheral/battery_status.
Open terminal and navigate to the directory with the example Makefile:
make to build the example:
Programming the firmware¶
If compiled successfully, the firmware is located in
battery_status/armgcc/_build with the name
While pushing the USER button, press the RESET button to enter the DFU mode. Then program the firmware using the nRF Connect for Desktop tool.
See Programming section for details about how to program your Pitaya Go.
Test the example by performing the following steps:
Connect a 3.7V Li-Po battery with 2-pin JST-PH connector to the Battery connector.
screen /dev/cu.usbmodemD2E39D222D781 115200
- Observe that the battery status is printed every 2 seconds.
Create an Issue¶
Interested in contributing to this project? Want to report a bug? Feel free to click here: