Pair (and Bond)

Now you can power up the keyboard button device with a battery (or USB power) and it will begin to advertise.

On your mobile device or computer with BLE, pick the device (the first time you connect it may have a generic name such as CIRCUITPYd133, later it may have the name Bluefruit Keybutton Control when it reconnects), and agree to the Pairing prompt. (Note, these photos are with a different device, but the process is identical.)

The devices will be paired, and automatically bonded so they can auto reconnect later.

Once connected, the keys will act just like any wireless keyboard to send input to your mobile device or computer. Try opening up a text editor and then press the five buttons.

In the sample code here's what each button will send:

  • button_1 = BACKSPACE
  • button_2 = the word "Bluefruit"
  • button_3 = the letter "L"
  • button_4 = the letter "e"
  • button_5 = ENTER


You can customize the code so your buttons send other keycodes. Here's a list of HID keycodes and modifiers to check out.

To customize the keycodes, look at this section of the code:

if not button_1.value:  # pull up logic means button low when pressed
            #print("back")  # for debug in REPL
        if not button_2.value:
            kl.write("Bluefruit")  # use keyboard_layout for words
        if not button_3.value:
            k.send(Keycode.SHIFT, Keycode.L)  # add shift modifier
        if not button_4.value:
        if not button_5.value:

This guide was first published on Jan 22, 2020. It was last updated on Jun 19, 2024.

This page (BLE Key Button Usage) was last updated on Mar 08, 2024.

Text editor powered by tinymce.