The HIDKeyboard example shows you how you can use the built-in HID keyboard AT commands to send keyboard data to any BLE-enabled Android or iOS phone, or other device that supports BLE HID peripherals.

Opening the Sketch

To open the ATCommand sketch, click on the File > Examples > Adafruit_BluefruitLE_nRF51 folder in the Arduino IDE and select hidkeyboard:

This will open up a new instance of the example in the IDE, as shown below:


Check the Configuration! page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI

If using software or hardware Serial UART:

  • This tutorial does not need to use the MODE pin, make sure you have the mode switch in CMD mode!
  • Don't forget to also connect the CTS pin on the Bluefruit to ground if you are not using it! (The Flora has this already done)

Running the Sketch

Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via Tools > Serial Monitor, and make sure that the baud rate in the lower right-hand corner is set to 115200:

To send keyboard data, type anything into the textbox at the top of the Serial Monitor and click the Send button.

Bonding the HID Keyboard

Before you can use the HID keyboard, you will need to 'bond' it to your phone or PC.  The bonding process establishes a permanent connection between the two devices, meaning that as soon as your phone or PC sees the Bluefruit LE module again it will automatically connect.

The exact procedures for bonding the keyboard will varying from one platform to another.

When you no longer need a bond, or wish to bond the Bluefruit LE module to another device, be sure to delete the bonding information on the phone or PC, otherwise you may not be able to connect on a new device!


To bond the keyboard on a Bluetooth Low Energy enabled Android device, go to the Settings application and click the Bluetooth icon.

These screenshots are based on Android 5.0 running on a Nexus 7 2013. The exact appearance may vary depending on your device and OS version.

Inside the Bluetooth setting panel you should see the Bluefruit LE module advertising itself as Bluefruit Keyboard under the 'Available devices' list:

Tapping the device will start the bonding process, which should end with the Bluefruit Keyboard device being moved to a new 'Paired devices' list with 'Connected' written underneath the device name:

To delete the bonding information, click the gear icon to the right of the device name and the click the Forget button:


To bond the keyboard on an iOS device, go to the Settings application on your phone, and click the Bluetooth menu item.

The keyboard should appear under the OTHER DEVICES list:

Once the bonding process is complete the device will be moved to the MY DEVICES category, and you can start to use the Bluefruit LE module as a keyboard:

To unbond the device, click the 'info' icon and then select the Forget this Device option in the menu:


To bond the keyboard on an OS X device, go to the Bluetooth Preferences window and click the Pair button beside the Bluefruit Keyboard device generated by this example sketch:

To unbond the device once it has been paired, click the small 'x' icon beside Bluefruit Keyboard:

... and then click the Remove button when the confirmation dialogue box pops up:

This guide was first published on May 01, 2015. It was last updated on Mar 08, 2024.

This page (HIDKeyboard) was last updated on Apr 30, 2015.

Text editor powered by tinymce.