BLE HID Mouse Example¶
The BLE HID Mouse Example demonstrates how to implement the HID over GATT profile for mouse.
The application includes the three mandatory services needed for the HID over GATT profile:
- Human Interface Device Service
- Device Information Service
- Battery Service
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: examples/nrf5-sdk/ble_app_hids_mouse.
Open terminal and navigate to the directory with the example Makefile:
make merge to build the application and merge with the Softdevice:
Programming the firmware¶
If compiled successfully, the firmware is located in
ble_app_hids_mouse/armgcc/_build with the name
Connect the debugger USB port to your PC using the provided USB-C Cable. A disk drive called M2-DOCK will be automatically detected by the computer.
Run the following command in
ble_app_hids_mouse/armgcc to program the board:
See Programming section for details about how to program the nRF52840 M.2 Module.
Use a computer with Bluetooth Low Energy supported to test the HID Mouse Example. Here goes with macOS.
After the application starts, observe that GREEN LED is blinking. This indicates that the device is advertising.
Go to System Preferences -> Bluetooth Preferences, observe that the BLE HID Mouse named nRF5_Mouse is found.
Connect to the mouse. Observe that GREEN constant light, that is, the connections is established.
Press USER button on the board. Observe that the mouse pointer on the screen moves to the left.
RESET the board to clear bond information from persistent storage before the next connection.
Create an Issue¶
Interested in contributing to this project? Want to report a bug? Feel free to click here: