|
1 | 1 | This example creates and updates a standard Battery Level service containing a single
|
2 | 2 | GATT characteristic.
|
3 | 3 |
|
4 |
| -Checking for Success |
5 |
| -==================== |
| 4 | +The [battery service transmits](https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml) a device's battery level in percentage, with 100% being a fully charged battery and 0% being a fully drained battery. |
6 | 5 |
|
7 |
| -Your BatteryLevel peripheral should be detectable by BLE scanners (e.g. a |
8 |
| -smartphone). To use your phone as a BLE scanner simply install one of the |
9 |
| -following apps: |
| 6 | +Although the sample application runs on a BLE device, it doesn't show the device's real battery level (because that changes very slowly and will make for a dull example). Instead, it transmits a fake battery level that starts at 50% (half charged). Every half second, it increments the battery level, going in single increments until reaching 100% (as if the battery is charging). It then drops down to 20% to start incrementing again. |
10 | 7 |
|
11 |
| -- For Android, you can get [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp). |
| 8 | +# Running the application |
12 | 9 |
|
13 |
| -- For iPhone, you can get [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8). |
| 10 | +## Requirements |
| 11 | + |
| 12 | +The sample application can be seen on any BLE scanner on a smartphone. If you don't have a scanner on your phone, please install : |
| 13 | + |
| 14 | +- [nRF Master Control Panel](https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp) for Android. |
| 15 | + |
| 16 | +- [LightBlue](https://itunes.apple.com/gb/app/lightblue-bluetooth-low-energy/id557428110?mt=8) for iPhone. |
| 17 | + |
| 18 | +Hardware requirements are in the [main readme](https://github.com/ARMmbed/ble-examples/blob/master/README.md). |
| 19 | + |
| 20 | +## Building instructions |
| 21 | + |
| 22 | +Building instructions for all samples are in the [main readme](https://github.com/ARMmbed/ble-examples/blob/master/README.md). |
| 23 | + |
| 24 | +## Checking for success |
| 25 | + |
| 26 | +1. Build the application and install it on your board as explained in the building instructions. |
| 27 | +1. Open the BLE scanner on your phone. |
| 28 | +1. Find your device. |
| 29 | +1. View the device's characteristics; the exact steps depend on which scanner you're using. |
| 30 | +1. The value of the battery level characteristic should be incrementing as explained above. |
| 31 | + |
| 32 | +If you can see the characteristic, and if its value incrementing correctly, the application worked properly. |
14 | 33 |
|
15 |
| -Using the phone app you can connect to the peripheral and observe how the |
16 |
| -battery level characteristic changes. |
|
0 commit comments